Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
people = 30
cars = 20
trucks = 10
#if cars are greater than people it will print otherwise it will go to the elif statement
if cars > people:
print("We should take the cars.")
#Since cars are not greater than people this statement will get printed. If this was not true it would go to the else statement
elif cars < people:
print("We should not take the cars.")
#This would be printed if the first two statements returned false
else:
print("we can't decide.")
if trucks > cars:
print("That's too many trucks.")
elif trucks < cars:
print("Maybe we could take the trucks.")
else:
print("we still can't decide.")
if people > trucks:
print("Alright, let's just take the trucks.")
else:
print("Fine, let's stay home then.")
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more