Lecture 1 2 Data Representation Handout
Lecture 1 2 Data Representation Handout
Sukrit Gupta
1 Bits
Bits
Computers have evolved over several decades. Why did they not
just have decimal digits?
What is the primary input to computers?
Electricity! Electricity can be used to represent information. How?
Computers store electricity to represent information. Presence =
1; absence = 0.
Decimal number 77 = 26 *1 + 25 *0 + 24 *0 + 23 *1 + 22 *1 + 21 *0 +
20 *1
= 1001101
Table: Conversion
Base 2 Base 10 Base 8 Base 16
(binary) (decimal) (octal) (hexadecimal)
0000 0 0 0
0001 1 1 1
0010 2 2 2
0011 3 3 3
0100 4 4 4
0101 5 5 5
0110 6 6 6
0111 7 7 7
1000 8 10 8
1001 9 11 9
1010 10 12 A
1011 11 13 B
1100 12 14 C
1101 13 15 D
1110 14 16 E
1111 15 17 F
Octal form:
Decimal number 77 = 82 *1 + 81 *1 + 80 *5.
= 115
Hexadecimal form:
Decimal number 77 = 161 *4 + 160 *D.
= 4D
1
Figure:
2
Figure:
2
Image courtesy: Sound in Digital Form
Sukrit Gupta Intro to Computing and Data Structures 20/25
Section 4
It’s old: Python has been around since the nineties. That doesn’t
only mean that it has had plenty of time to grow. It has also
acquired a large and supportive community.
It’s beginner-friendly: The syntax of Python is very
human-readable and many other features make it easy for
beginners.
It’s versatile: Since Python has been around for so long,
developers have made a package for every purpose. These days,
you can find a package for almost everything.