IF ELIF ELSE example 2
Wed Mar 17 2021 20:21:58 GMT+0000 (Coordinated Universal Time)
Saved by
@fre_apples
#python
print("I have information for the following planets:\n")
print(" 1. Venus 2. Mars 3. Jupiter")
print(" 4. Saturn 5. Uranus 6. Neptune\n")
weight = 185
planet = 3
# Write an if statement below:
if planet ==1:
weight = weight * 0.91
print("Venus")
elif planet ==2:
weight = weight * 0.38
print("Mars")
elif planet ==3:
weight = weight * 2.34
print("Jupiter")
elif planet ==4:
weight = weight * 1.06
print("Saturn")
elif planet ==5:
weight = weight * 0.92
print("Uranus")
else:
weight = weight * 1.19
print("Neptune")
print("Your weight:", weight)
content_copyCOPY
Comments