Skip to content
Advertisement

Python program that tells you whether or not you need an umbrella when you leave the house [closed]

The program should:

  1. Ask you if it is raining using input()
  2. If the input is ‘y’, it should output ‘Take an umbrella’
  3. If the input is ‘n’, it should output ‘You don’t need an umbrella’

Advertisement

Answer

you can do this in several ways:

JavaScript

also you can do it in just one line like this which is probabely an advanced way:

JavaScript

also you can first save the input in a variable, and then handle it in if blocks

JavaScript

the x.lower() makes it acceptable even if user inputs Y or N in capital letters.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement