> Python program that will toss a coin?

Python program that will toss a coin?

Posted at: 2014-12-18 
import random

print random.randint (1, 2)

Write a program that simulates three coin tosses, by generating three random numbers from the set {1,2}. If number 1 was generated, consider that head was up. If number 2 was generated consider that tail was up. The program should use two variables heads and tails to count how many heads and how many tails were tossed.

Sample runs (note that this program takes NO USER INPUT)

>>> ================================ RESTART ================================

>>>

This program will toss a coin 3 times, show the tosses,

count heads and tails and print the winner.

Tossing..... tail ( 2 )

Tossing..... tail ( 2 )

Tossing..... head ( 1 )

1 heads and 2 tails

Winner: Tails