move python file to assignments
This commit is contained in:
parent
075c3aa044
commit
8ab7d1fde4
14
assignments/icecream.py
Normal file
14
assignments/icecream.py
Normal file
@ -0,0 +1,14 @@
|
||||
def ask_yes_no(prompt):
|
||||
while True:
|
||||
answer = input(prompt + ' (y or n) ')
|
||||
if answer == 'y' or answer == 'Y':
|
||||
return True # returning ends the function
|
||||
if answer == 'n' or answer == 'N':
|
||||
return False
|
||||
print("Answer 'y' or 'n'.")
|
||||
|
||||
if ask_yes_no("Do you like ice cream?"):
|
||||
print("You like ice cream!")
|
||||
else:
|
||||
print("You don't like ice cream.")
|
||||
|
Reference in New Issue
Block a user