-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_variable-datatype.py
45 lines (44 loc) · 1.11 KB
/
02_variable-datatype.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
print(1,2,3 ,sep='-sepration')
number : int = 23
print(number)
print("Variables")
x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)
o = str(3) # x will be '3'
p = int(3) # y will be 3
s = float(3) # z will be 3.0
print("------------------------------")
a= 10
b= "safwan"
print(a) #seprate show in line
print(b) #seprate show in line
print(a,b)#show same in line
print("------------------------------")
print("Data-Types")
a=10
b=20.9
c="string"
d=True
e=None
print("------------------------------")
print("printing the variable along with data-type")
print(type(a),a)
print(type(b),b)
print(type(c),c)
print(type(d),e)
print(type(e),d)
print("------------------------------")
print("Print list,tuple,sets and distnory")
print("Display the list")
print([1,2,3,4,5])
print(type([1,2,3,4,5]))
print("Display the tuple")
print((1,2,3,4,5))
print(type((1,2,3,4,5)))
print("Display the sets")
print({1,2,3,4,5})
print(type({1,2,3,4,5}))
print("Display the distnory")
print(({'name':['safwan','ahad','ali'],'class':['12','11','10']}))
print(type({'name':['safwan','ahad','ali'],'class':['12','11','10']}))