Question: Write a Python script that allows two players to play the matchstick game. The matchstick game starts with 21 matchsticks in a pile on their

 Write a Python script that allows two players to play the

Write a Python script that allows two players to play the matchstick game. The matchstick game starts with 21 matchsticks in a pile on their tuma player may remove 1-3 matchsticks from the pile, and the person to take the last matchstick loses. At the start of each player's turn, print which player's turn it is and how many matchsticks are left. Reprompt players if they enter an invalid move. Player 1 should make the first move, player 2 second, 1 third, etc. Print a congratulatory message to the winning player after the last matchstick is taken Hint: make sure that a player can't remove more matchsticks from the pile than the pile contains

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!