-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathifelse14,41.py
More file actions
32 lines (31 loc) · 750 Bytes
/
ifelse14,41.py
File metadata and controls
32 lines (31 loc) · 750 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
applePrice = 210
budget = 200
if (applePrice <= budget):
print("Alexa, add 1 kg Apples to the cart.")
else:
print("Alexa, do not add Apples to the cart.")
num = 0
if (num < 0):
print("Number is negative.")
elif (num == 0):
print("Number is Zero.")
else:
print("Number is positive.")
num = 18
if (num < 0):
print("Number is negative.")
elif (num > 0):
if (num <= 10):
print("Number is between 1-10")
elif (num > 10 and num <= 20):
print("Number is between 11-20")
else:
print("Number is greater than 20")
else:
print("Number is zero")
#Shorthand if else
a = 330
b = 330
print("A") if a > b else print("=") if a == b else print("B")
result = "mohan" if (False) else "sohan"
print(result)