conditions
# if-elif-else ladder in python
# a = 8
# if(a>3):
# print("the value of a is greater than 3")
# elif(a>7):
# print("the value of a is greater than 7")
# elif(a>13):
# print("the value of a is greater than 13")
# elif(a>17):
# print("the value of a is greater than 17")
# else:
# print("the value of a is greater than 3,7,13 or 17")
# 2. multiple if statements
a = 15
if(a>3):
print("the value of a is greater than 3")
if(a>7):
print("the value of a is greater than 7")
if(a>13):
print("the value of a is greater than 13")
if(a>17):
print("the value of a is greater than 17")
else:
print("the value of a is not greater than 17")
print("true")
# b = 22
# if(a>9):
# print("greater")
# else:
# print("lesser")
if-elif-else
# age = int(input("enter your age"))
# if age>18:
# print("Congrats, you are eligible for vote")
# else:
# print("sorry, you are not eligible for vote")
# age = int(input("enter your age"))
# if (age>18 or age<56):
# print("Congrats, you are eligible for work")
# else:
# print("sorry, you are not eligible for work")
# a = None
# if (a is None):
# print("yes")
# else:
# print("no")
# b= [45,44,34]
# print(32 in b)
a = 67
if (a==7):
print("yes")
elif(a>54):
print("no and yes")
else:
print("i am optional")
Comments
Post a Comment