Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

sed to edit it's afer to sty in Protected View Enable Editing 7 6 Python Shell Eile Edit Shel ] Rebug Eptions Windows Help $

sed to edit it's afer to sty in Protected View
Enable Editing
76 Python Shell
Eile Edit Shel] Rebug Eptions Windows Help
$>> Welcome to P1ck Up Sc1cks.
Each player takes turns p1cking up from 1
to 4 st1cks from a p1le of 13 st1cks.
Whoever Dicks up the last stick wins.
There are 13 stick(s) left.
Player 1
how many sticks w111 you take? 4
There are 9 stick(s) left.
Player 2
how many st1cks w111 you take? 9
You can't take 9 sticks.
How many will you take? 6
You can't take 6 st1cks.
How many w111 you take? 2
There are 7 stick(s) left.
Player 1
how many sticks will you take? 1
There are 6 stlck (s) left.
Player 2
how many st1cks w111 you take? 3
There are 3 stick(s) left.
Player 1
how many sticks will you take? 3
Player 1 wins!
Press the enter key to exit.
Press the enter key to exit. 1
ent_Python_1511(1)- Protected View - Saved to this PC V
lings
Review
View
Help
less you need to editit's safer to stay in Protected View.
Enable Editing
2. The game is "Pick Up Sticks". Below is the pseudo code for the problem. Implement the problem using Python code.
Set maximum number of sticks a player can take to 4
Set minimum number of sticks a player can take to 1
Set total number of sticks to 13
Set current player to player 1
Display game instructions
While there are still sticks in pile
Ask current player how many sticks he or she wants
While current player asks to take more than number of sticks left or more than maximum or less than minimum
Ask current player how many sticks he or she wants
Reduce number of sticks in pile by number of sticks current player asked to take
If no sticks left
Current player wins
Make current player other player
See the figure on the next page for a simulation.
See the figure on the next page for a simulation.
[B], Focus
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Explain the various employee benefit laws.

Answered: 1 week ago

Question

Describe the premium pay benefit practice.

Answered: 1 week ago