Files
python-2020-5-day-class/weather_app.py
ducoterra 09b4bc8f5b day 2
2020-11-09 21:12:58 -05:00

52 lines
1.1 KiB
Python

import random
warm = random.choice([True, False])
cold = not warm
raining = random.choice([True, False])
snowing = not raining
if warm or cold:
print("It's warm or snowing.")
if raining or warm:
print("It's raining or warm.")
if raining or snowing:
print("It's raining or cold.")
if cold or snowing:
print("It's cold or snowing.")
warm_guess = input("Is it warm? (y/n) ")
if warm_guess == 'y' and warm:
print('Correct!')
elif warm_guess == 'n' and not warm:
print('Correct!')
else:
print('Wrong!')
cold_guess = input("Is it cold? (y/n) ")
if cold_guess == 'y' and cold:
print('Correct!')
elif cold_guess == 'n' and not cold:
print('Correct!')
else:
print('Wrong!')
raining_guess = input("Is it raining? (y/n) ")
if raining_guess == 'y' and raining:
print('Correct!')
elif raining_guess == 'n' and not raining:
print('Correct!')
else:
print('Wrong!')
snowing_guess = input("Is it snowing? (y/n) ")
if snowing_guess == 'y' and snowing:
print('Correct!')
elif snowing_guess == 'n' and not snowing:
print('Correct!')
else:
print('Wrong!')