-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.py
More file actions
66 lines (56 loc) · 1.03 KB
/
Copy pathb.py
File metadata and controls
66 lines (56 loc) · 1.03 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
# varaible assignment
a = 10
b = 20
c = 30
print("a = ",a)
print("b = ",b)
print("c = ",c)
a,b,c = 40,50,60
print("a = ",a)
print("b = ",b)
print("c = ",c)
a=b=c=80
print("a = ",a)
print("b = ",b)
print("c = ",c)
#data types
x = 20
y = "python"
z = 84.56
switch_on = False
print(type(x))
print(type(y))
print(type(z))
print(type(switch_on))
#type conversion
x = float(x)
print(x)
#type conversion and addition
age = 22
num = "100"
print((int(num)) + age )
#printing mutiple varaibles using single print function(f-strings or formatted strings)
name = "xyz"
age = 22
collage ="abc"
print(f"name = {name}, age = {age}, collage = {collage}")
print(name,age,collage)
print(f"{name}\n{age}\n{collage}")
# arthematic operations
a,b = 3,2
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a//b) #floor divison
print(a%b) #modulus
print(a**b) #exponent(3**2 = 9)
# combining different operators
print(10+8/2*3)
print(25//4+3*2)
#swaping varaibles
a = 10
b = 20
a,b=b,a
print(a)
print(b)