Hello. Right now I am learning the python language through Python Programming
for the Absolute Beginner 3rd Edition. I am having trouble with one question in
Ch. 3 #2, which says "Write a program that flips a coin 100 times and then
tells
you the number of heads and tails." Right now I am having trouble connecting
the
random.randint function into the loop.
# Coin
import random
# Set up Values
coin = random.randint(1,2)
tails = 0
heads = 0
if (coin == 1):
tails += 1
else:
heads += 1
toss = 0
while toss < 100:
toss += 1
coin = input(random.randint(1,2)
print("Toss Count:", count)
print("Tails:", tails)
print("Heads:", heads)
input("\n\nPress the enter key to exit.")
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor