-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay2.py
More file actions
63 lines (42 loc) · 753 Bytes
/
Day2.py
File metadata and controls
63 lines (42 loc) · 753 Bytes
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
# Integers and Floats
num = 1
print(type(num))
num1 = 3.14
print(type(num1))
#Arithmetic operations
print(3/2)
print(3//2)
print(3%2)
#orders of operations
print(3 * 2 + 1)
print(3 * (2 + 1))
#Incrementing
num = 1
num = num + 1
print(num)
# or
num = 1
num += 1
print(num)
# Absolute method()
print(abs(-5))
print(abs(5))
# Round funtion
print(round(3.75))
# Rounding with the second argument
print(round(3.755648, 3))
# Comparisons
print(3 == 2)
print(3 != 2)
print(3 > 2)
print(3 < 2)
print(3 >= 2)
print(3 <= 2)
# With Strings
num_1 = '100'
num_2 = '200'
print(num_1 + num_2)
# we can add them using casting
num_1 = int(num_1)
num_2 = int(num_2)
print(num_1 + num_2)