Last active
May 27, 2016 14:30
-
-
Save messa/bb1eee47cf07e3a84dbd to your computer and use it in GitHub Desktop.
funkce (Pyladies CZ 2015)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ano_nebo_ne(otazka): | |
"Vrátí True nebo False, podle odpovědi uživatele" | |
while True: | |
odpoved = input(otazka) | |
if odpoved == 'ano': | |
return True | |
elif odpoved == 'ne': | |
return False | |
else: | |
print('Nerozumím! Odpověz "ano" nebo "ne".') | |
if ano_nebo_ne('Chceš si zahrát hru? '): | |
print('OK! Ale napřed si ji musíš naprogramovat.') | |
else: | |
print('Škoda.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
odpoved = input('Chceš si zahrát hru? ') | |
if odpoved == 'ano': | |
print('OK! Ale napřed si ji musíš naprogramovat.') | |
break | |
elif odpoved == 'ne': | |
print('Škoda.') | |
break | |
else: | |
print('Nerozumím! Odpověz "ano" nebo "ne".') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment