-
-
Save siminino/2013248 to your computer and use it in GitHub Desktop.
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
>> import random | |
>> | |
>> def possibilidade(respostas_do_guru): | |
>> contador = 0 | |
>> while True: | |
>> resposta = random.choice(respostas_do_guru) | |
>> contador += 1 | |
>> if resposta == 'sim': | |
>> return '1 em %d' % contador | |
>> | |
>> possibilidade(respostas_do_guru) | |
>> 1 em 18 |
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
>> import random | |
>>> respostas_do_guru = ["nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","nao","talvez","sim"] | |
>>> random.choice(respostas_do_guru) | |
'nao' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment