elif Exercises

Task 1

1. Write a conditional statement with three branches that determine if the input below is positive, negative, or zero. --- num = int(input("Enter a number"))

Task 2

Improve the code below to check whether the user entered a negative number. The message "Please enter a positive number" should be displayed if a negative number is entered. --- if richter >= 8.0 : print("Most structures fall") elif richter >= 7.0 : print("Many buildings destroyed") elif richter >= 6.0 : print("Many buildings damaged, some collapse") elif richter >= 4.5 : print("Damage to poorly constructed buildings") else : print("No destruction of buildings")

Task 3

Draw a flowchart diagram that reads a value temp. If it is less than zero, print "Ice". If it is greater than 100, print "Steam". Otherwise print "Liquid".