I need a small tips to finished this exercise. The program should display head or tail after the for loop generate a sequence of 0 and 1. This module contains a number of random number generators:
import random
# function to determine head or tail of printed random number
def flip(coin):
# if the coin is zero, then print head
if coin == 0:
print("heads!")
# else print tail
else:
print("Tail!")
# simple repeat loop that calls flip() 10 times to generate a random
# sequence of 10 heads and tails
def main():
for coin in range(10):
print (random.randrange(2))
main()