-
Notifications
You must be signed in to change notification settings - Fork 1
/
#2_variables.py
54 lines (42 loc) · 880 Bytes
/
#2_variables.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
46
47
48
49
50
51
52
53
54
# variable - a container for a value. Behaves as the value that it contains
name = ' Ishtiaq'
print("Hello"+name)
data_type = type(name)
#string
f_str = 'First '
s_str = 'Second'
full_str = f_str + s_str
print(full_str)
# int
age = 32
age +=1
print(age)
print(type(age))
#print("Your age is : " + age) # error - can only concatenate str to str
print("Your age is : " + str(age))
# float
height = 270.6
print(height)
print(type(height))
print("Your height is : "+ str(height) + " cm")
# boolean
human = True
print(human)
print(type(human))
print("Are you a human ? -> "+ str(human))
# example - 1
car = 'Volvo'
truck = 'Cybertruck'
color_c = 'red'
color_t = 'silver'
print(car + " is " + color_c + " and " + truck + " is " + color_t)
# combining multiple variable
a, b, c, d = 10, 11, 12, 13
print(a)
print(b)
print(c)
print(d)
x = y = z = 10
print(x)
print(y)
print(z)