-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_Conditional Statements.py
More file actions
77 lines (65 loc) · 1.61 KB
/
08_Conditional Statements.py
File metadata and controls
77 lines (65 loc) · 1.61 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
67
68
69
70
71
72
73
74
75
76
77
## Condition Control: I will play cicket when the weather is sunny.
## Loop: I will keep checking out Dishe untill all the dishes are over in a buffet.
## Break: I will check out all the dishes untill I get sweets
##Conditional Statement:Helps to code decision based on some Pre-condions
##If statement
validAge=19
if validAge>18:print("Eligiable for Driving License.")
invalidAge=10
if invalidAge>18:print("Not Eligiable for Driving License.")
number=42
if (number%2)==0:
print("Number is Even")
##If else statement
#If yor'r age is less than 12, then you can travel free
childAge=28
if(childAge<=12):
print("You can travel Free")
else:
print("You need to pay")
#If student's marks is greater than 10 he is "Pass" otherwise he is "Fail"
studentMarks=10
if(studentMarks>=10):
print("Pass!")
else:
print("Fail!!!")
##elif statement
marks=65
if(marks>=90):
print("Grade A")
elif(80<=marks<89):
print("Grade B")
elif(70<=marks<79):
print("Grade C")
elif(50<=marks<69):
print("Grade D")
elif(30<=marks<49):
print("Grade E")
else:
print("Grade F")
age=26
if (age<=12):
print("You are Child")
elif(age<=19):
print("You are Tenager")
else:
print("You are Adult")
num=9800
if(num<=10):
print("Number is less than 10")
elif(num<=100):
print("Number is less than 100")
elif(num<=1000):
print("Number is less than 1000")
else:
print("Number is gretaer than 1000")
##Nested If Statement
x=10
y=20
if(x>5):
if(y>5):
print("Both x and y greater than 5")
else:
print("X is greater than 5 but Y is less than 5")
else:
print("Both x is less than 5")