-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasics.py
70 lines (56 loc) · 1.09 KB
/
basics.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
num = int(input("Enter an integer: "))
print("You entered:", num)
num1 = int(input("Enter another integer: "))
print("You entered:", num1)
sum_result = num + num1
print("Addition of two numbers is:", sum_result)
sub_result = num - num1
print("Subtraction of two numbers is:", sub_result)
if num1 != 0:
div_result = num / num1
print("Division of two numbers is:", div_result)
else:
print("Division by zero is not allowed.")
if num1 != 0:
rem_result = num % num1
print("Remainder is:", rem_result)
else:
print("Cannot compute remainder with zero.")
if num1 != 0:
flt_result = num // num1
print("Integer division result is:", flt_result)
else:
print("Cannot perform integer division by zero.")
pow_result = num ** num1
print("Power result is:", pow_result)
a = 10
b = 10.5
c = a + b
print(c)
x = 3.14
y = int(x)
print(y)
a = 21
b = 13
c = 40
d = 37
p = (a - b) <= (c + d)
print(p)
P = (9 == 9)
Q = (7 > 5)
R = P and Q
S = P or Q
T = not P
print(R)
print(S)
print(T)
a = 12
x = a >> 2
y = a << 1
print(x, y)
a = 16
b = 12
c = a + (b >> 1)
print(c)
name = 'Roshan'
print(name)