day 2
This commit is contained in:
51
weather_app.py
Normal file
51
weather_app.py
Normal file
@@ -0,0 +1,51 @@
|
||||
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!')
|
||||
Reference in New Issue
Block a user