CBSE Class 11 Computer Science
Question 41 of 80
Getting Started with Python — Question 6
Back to all questionsStep 1: Initialize Counters:
SET p1 = 0
SET p2 = 0
Step 2: Process Coin Flips:
FOR each flip from 1 to 5
INPUT result
IF result is 1 THEN
INCREMENT p1
ELSE IF result is 2 THEN
INCREMENT p2
IF p1 is 3 THEN
PRINT "Player 1 wins the cake."
EXIT the algorithm
ELSE IF p2 is 3 THEN
PRINT "Player 2 wins the cake."
EXIT the algorithm