-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconditions.py
More file actions
46 lines (35 loc) · 894 Bytes
/
conditions.py
File metadata and controls
46 lines (35 loc) · 894 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
#conditional expressions help with the control of our codes.
#if
#elif
#else
#while
#using "if" with some expressions
a = 45
b = 45
if a < 50:
print("yes", a, "is less than 50")
if a > 50:
print ("no", a, "is not greater than 50")
if (a % 2) == 1:
print (a, " is not divisible by 2")
if (b % 3) == 0:
print (b, " is divisible by 3")
if (a - 10) < b:
print ("subtraction done and less that")
else:
("subraction not done")
if (a <= b):
print("yes, one is either greater or both are equal")
if (a >= b):
print("yes, one is either lesser or both are equal")
#using while to control the number of printing
x = 6
y = 0
while(y < x)
print (y) #prints y
y = y + 1 #performs additon to y by 1 before printing of y
#using if and elif(else if)
if (a/3) == 15:
print ("yes ", a, " is divisible by 3")
elif (a-b) == 0:
print ("none left")