Investigate
Look at the code on the right.
Run it and see what it does.
Click on the pencil icon at the top to see the code again.
Run the program and see what it does
Can you add your own elif statement on line12?
Run the program. What does this do? Try entering a number between 1 and 10
Try entering a word
Now try a number below 0 or a number bigger than 10. What happens?
Run the program. Try entering xx@email.com
Change the variable for myEmail to make it easier to test.
See the rest of the comments in the code and see what happens
print("What shall I do today?")
weather = input("What is the weather like today? ")
print("Time to play tennis.")
print("Time to stay inside and read a book.")
elif weather == "Snowing":
print("Time to go Skiing!")
#TODO: Add an elif statement here for "Foggy"
print("Guess I don't know what to do with this weather")
#Run the code. Make sure you understand it before changing it.
#What happens if I put == here? Change the number as well!
print("One go only. Guess my number which is between between 1 and 10:")
if number == numberToGuess:
elif number < numberToGuess and number >= 0:
# What does this line do? It has the word 'and'.
elif number > numberToGuess and number <= 10:
#Notice this time it is <=
#Enter a number that gets this to print.
#Run the code - When you understand the code, change some of the if conditions. Then move on to the next section
enteredEmail = input("Enter User email: ")
if (enteredEmail.lower() == myEmail.lower()):
#Does the code still work if you change if to elif?
if (enteredEmail == "Harry"):
print("Hagrid left a message:")
print("You are a wizard, Harry!")
newPassword = input("Your Password has expired. Enter new Password: ")
#Change the comparison here
if (len(newPassword) < 3):
print("Your Password is ridiculously short")
passwordConfirm = input("Type your password again. ")
#What happens if I change == to = ?
if (newPassword == passwordConfirm):
print("Brilliant. They match. New password saved. ")