-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConditional.py
More file actions
57 lines (37 loc) · 1.03 KB
/
Conditional.py
File metadata and controls
57 lines (37 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
a = int(input("Enter your age: "))
# If else statement
if(a>=18):
print("You are above the age of consent")
print("Good for you Dear")
else:
print("You are below the age of consent")
print("Better luck next time my boy")
print("End of Program")
# If elif else ladder
a = int(input("Enter your age: "))
if(a>=18):
print("You are above the age of consent")
print("Good for you")
elif(a<0):
print("You are entering an invalid negative age")
elif(a==0):
print("You are entering 0 which is not a valid age")
else:
print("You are below the age of consent")
print("End of Program")
# Multiple_if_statements
a = int(input("Enter your age: "))
# If statement no: 1
if(a%2 == 0):
print("a is even")
# End of If statement no: 1
# If statement no: 2
if(a>=18):
print("You are above the age of consent")
print("Good for you")
elif(a<0):
print("You are entering an invalid negative age")
else:
print("You are below the age of consent")
# End of If statement no: 2
print("End of Program")