IDC101 Lect0 Part1
IDC101 Lect0 Part1
Introduction to Programming
Lecture 0
https://chatgpt.com/ Lets ask a
What is programming programmed ChatGPT
Programming is the process of creating a set of instructions that a computer can follow to perform specific tasks or
solve problems. These instructions, known as code, are written in programming languages such as Python, Java,
C++, JavaScript, and many others.
Not really ?
We can program a monkey, dog, cat, cow, and any animal to do something based on some instructions and reward
system.
What I am today is :
“ A programmed software installed in my brain without my knowledge and I am working, behaving as per the training
received by me either knowing or un-knowing”
Now coming back to this course: "The Matrix is everywhere. It is all around us. Even now in this
very room" – Morpheus (The Matrix)
IDC 101 : Introduction to programming "The Coding is everywhere. It is all around us. Even now in this
very room" – Random Person (The World named Matrix)
Allen B. Downey, Think Python: How to Think Like a Computer Scientist, 2nd Edition
Richard Peterson, Linux: The Complete Reference 6th edition, Tata McGraw (2008).
The online material available at http://docs.python.org/
I will not follow the exact syllabus.
My purpose of teaching this course is not to teach math or Numerical Methods, but to make you enjoy and love
coding. There are lot of Numerical courses you can do.
We will do most of them, but focus is more on learning the skill and love for coding.
One can’t learn how to do programming, one can just experience and feel.
"I can only show you the door, you're the one that has to walk through it" – Morpheus (The Matrix)
What I expect you to learn or take away from this course ?
Python : Learn about its basic, its common libraries, plotting tools.
Component Marks
Attendance (lab) 10
Lab Reports 30
End Sem Lab Exam 30
End Sem Exam 30
Most of the operating system which run on the Desktop and laptop are:
Kernel : computer program at the core of a computer’s OS and generally has complete control over everything in
the system.
The kernel is also responsible for preventing and mitigating conflicts between different processes.
On most systems, the kernel is one of the first programs loaded on startup or bootloader.
It handles the rest of startup as well as memory, peripherals, input/output requests from software, translating
the work into instructions from CPU.
Type of Linux Operating System
Debian based : empahsizes free software. It supports many hardware platforms. Debian and distributions based on it use .deb package
format and dpkg package anager and its frontends.
Ubuntu, Knoppix, Kali Linux, Mint, PureOS, BOSS, Puppy Linux, Rapberry pi OS
Pacman-based : primarily developed and used by Arch Linux and its derivative. Default installation is minimal base system, configured
by user to only add what is purposely required.
Garuda Linux, Manjaro, SteamOS, BlackArch
RPM based
Red Hat Linux and SUSE Linux were original major distributions that used .rpm files format, which today is used in several package
management system. Both of these were later divided into commercial and community-supported distributions.
RHEL, Fedora, Fermi Linux LTS, Scientific Linux, CentOS, SUSE Linux Enterprise,
Gentoo Based: Distributions based on Gentoo use the Portage package management system with emerge or one of the alternative
package managers.
ChromiumOS, ChromeOS, Sabayon
Slackware based: Slackware is a highly customizable distribution that stresses ease of maintenance and reliability over cutting-edge
software and automated tools.
Absolute Linux, KateOS, VectorLinux, Slax
Android based: mobile operatinf system bought and developed by Google., based on google modified linux kernel.
Android-x86, Fore OS, GrapheseOS
https://en.wikipedia.org/wiki/List_of_Linux_distributions
"Choice. The problem is choice" – Neo (The Matrix Reloaded)
"Choice is an illusion created between those with power and those
without" – Merovingian (The Matrix Reloaded)
Mostly the graphics or creative related stuff (specially working with Adobe, Windows PowerPoint, sheet). As
expected the market or business related software are optimized for these platforms. But these days, one can
also install them on Linux and unleash their potential.
Some machine only has driver for Windows or Mac because of the agreement between the companies.
However, this is now changing. More companies are making drivers easily available for the Linux.
Is Linux safe ?
Safe as long as you know what you are doing and not downloading or visiting fishy sites.
*I am running Ubuntu on
Windows using App
Command
https://www.digitalocean.com/community/tutorials/linux-commands
Instruction given to system to do particular action.
man -> Allow you to access the manual pages of the Linux command
Try
man man
if you want to exit, type q. Please read/follow the instructions provided by the computer
uname
uname -a
We provide option for the command with “–a”
One can simply just use keyboard and make computer do most of
the work.
The day you started using terminal a lot and start hating the GUI.
You would be able to do things without even using mouse.
That day you reach Nirvana in coding and will become NEO
"I don't like the idea that I’m not in control of my life" –
Neo (The Matrix)
“ cd ” → change directory
cd directory1/directory2
mkdir directoryNew
“rm” → Delete files or directories .. The most powerful command of the system.
Use this command careful.
The most powerful is “rm –rf” Avoid using it as much as possible
Programming Language
If your system has not much space, there are lot of linux which can simply boot from pendrive (but try to save the work/code
everytime)
Most lighter Linux I have used is puppy linux (it can even run on old systems without any problem) even support 32 bit with 256 RAM and CP
600Hz processor
I want you to use a simple editor like vi, emacs (I prefer emacs) to edit/write a code.
Compile the code and print.
Before starting to code, I want everyone to make a proper flow chart
Some Tips to be better coder
1) Always Write detailed comments on your code. This will help you in long run.
2) Catalogue and make better directories. Arrange the code and work in workspace.
3) Always think of using less memory and think that computer has limited memory.
4) If code is working, don’t touch it.
5) If need to modify the code. Make a copy of that code with version and date. Then
start working on that code. There is a strong chance that you may either make the
code buddy or the code might not work. Always doubt your coding skill.
6) Introduce only those features which are required. Don’t over do or don’t under do
the coding.
7) Always keep your code simple. Follow “K.I.S.S. – Keep it Simple and Stupid”
8) Never introduce the variables which are not required in the code.
9) Test your code for multiple case scenarios.
10)Always assume that computer don’t know anything.
Question: When I will become expert in coding.
By the time you learn one language or think you are expert.
The world will move to another new language because of some cool features and a new generation
pushing/believing it to be cool.
FORTRAN
Used to have indentation
C++
Brackets (who the hell need indentation, blocks, brackets are the new cool)
Python
Indentation (who the hell need ugly brackets, blocks and indentation is the new cool)
But the one things which remain same in every coding language is
Logics
And
Bugs.
Machine Language
▪ Referred to as machine code which is set of binary digits 0 and 1.
▪ These binary digits are understood and read by a computer system and interpret it easily.
▪ It is a native language as it can be directly understood by the central processing unit (CPU).
Assembly Language
▪ Low-level language for microprocessors and many other programmable devices.
▪ The assembly language is also considered as second-generation language.
▪ It is mostly famous for writing an operating system and also in writing different desktop applications.
▪ The operations carried out by programmers using assembly language are memory management, registry access,
and clock cycle operations.
▪ The drawback of assembly language is the code cannot be reused and the language is not so easy to understand
If you are more interested to build customized electronic boards, where signal processing and fitting has to be done:
FPGAs programming is crucial.
These days FPGAs even contain integrated processors which is a system in itself.
For that one need to use VHDL or Verilog programming.
Add two 8-bit numbers
https://www.javatpoint.com/programming-in-8085
http://computerscience.chemeketa.edu/cs160Reader/Programmin
gLanguages/Assembly.html
Assembly language
High level
language
https://www.geeksforgeeks.org/cpp-add-numbers/
How to represent numbers
You are well aware that numbers can be represented in various form
Octal : base 8 : Yuki and Pamean languages, as speakers count using spaces between their fingers
(0,1,2,3,4,5,6,7,10).
It became widely used in computing systems as UNIVAC 1050, PDP-8, ICL 1900 an dIBM mainframes employed 6-bit,
12-bit, 24-bit or 36-bit words.
Each Octal digit represents three binary digits. So, 2,4,8 or 12 digits could concisely display an entire machine word.
Hexadecimal: base 16 : Ancient Chinese. Used widely by computer system designers and programmers because they
provide human-friendly representation of binary-coded values.
Each hexadecimal digit represents four bits ( nibble or nybble, which is half a byte)
Representation of numbers on computer
103 102 101 100 10−1 10−2 10−3
5 3 0 1 . 4 7 9
5 × 103 +3 × 102 +0 × 101 +1 × 100 +4 × 10−1 +7 × 10−2 +9 × 10−3 = 5301.479
The base(radix) of a number system determines the number of distinct values that can be used to
represent any arbitrary number. The decimal number is said to be of base 10.
23 22 21 20 2−1 2−2 2−3
Binary fraction
1 0 0 1 . 1 0 1
Position of a digit in a number is important. Certain weight is assigned to each position of a digit in a number.
Right most position of digit in a number has the lowest weightage and is called Least Significant Digit (LSD).
The digit in the extreme left position has maximum weightage and is thus called Most Significant Digit (MSD).
For a binary number, the bit (0 or 1) on the right most position is called the Least Significant bit (LSB) and the bit on the
extreme left position is called the Most Significant bit (MSB).