Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

heads or tails python

from random import random

def heads_or_tails():
    guess = input('Pick heads or tails and then press eneter to play: ')
    if random() > 0.5:
        return 'tails'
    else:
        return 'heads'

print(heads_or_tails() + ' wins' + '!')
 
PREVIOUS NEXT
Tagged: #heads #tails #python
ADD COMMENT
Topic
Name
7+6 =