Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
Simulate coin flips with:
coin = random.randint(0, 1) # 0 = Tails, 1 = Heads
Repeat until either heads or tails has appeared 10 times.
For each flip, print Heads or Tails.
At the end:
Heads Wins! or Tails Wins! (whichever reached 10 first; they cannot tie at the end).Use import random, a while loop, and if / elif as needed.
Skills: two counters, compound while condition.