Skip to content

Instantly share code, notes, and snippets.

@siminino
Forked from andrewsmedina/gist:2013101
Created March 10, 2012 21:22
Show Gist options
  • Save siminino/2013248 to your computer and use it in GitHub Desktop.
Save siminino/2013248 to your computer and use it in GitHub Desktop.
>> 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
>> 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