Notes
Notes
CPU
ALU: for arithemtic and logical part
CU: Co-ordination Part
We are going to write code (called source code) using some high level proramming
language (may be python, java, swift, go, .net). Ultimately computer is going to
understand only one language that is binary i.e. machine code.
Memory Units
4 GB = 4 x 1024 MB
4 GB = 4 x 1024 x 1024 KB
4 GB = 4 x 1024 x 1024 x 1024 B
4 GB = 2^2 x 2^10 x 2^10 x 2^10 B
4 GB = 2^32 B
Every memory location (of 1 byte) is identified using a physical address which is
very difficult to remember and process for human (e.g. 0xAFE2:585A)
What is variable?
General Definition: A variable is a named memory location whose value can be
changed.
python specific definition: A variable is reference to memory location (called
object) that has value actually means in python programming A variable does not
store value but a variable store the location of the object such that actually the
value is available in the object.
In python programming, type function is available to check the data type of the
variable
+-+-+-+-+-+-+-
+ An Example +
+-+-+-+-+-+-+-
age = 17
print(age, type(age))
percentage = 85.25
print(percentage, type(percentage))
st_name = "Om"
print(st_name, type(st_name))
gender = 'M'
print(gender, type(gender))
Execution
stack heap
|74859658|--->|___17___| (object)
age 74859658
|74253698|--->|__85.25_| (object)
percentage 74253698
|74147859|--->|__Om_| (object)
st_name 74147859
|74268952|--->|__M_| (object)
gender 74268952
Output
8 <class 'int'>
85.25 <class 'float'>
Om <class 'str'>
M <class 'str'>