Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need some more help with Python coding here is my code print (welcome to Pick Up Sticks ) print (Each player takes turn

image text in transcribed

Hi I need some more help with Python coding here is my code

print ("welcome to Pick Up Sticks ") print ("Each player takes turn picking up from 1") print ("to 4 sticks from a pile of 13 sticks.") print ("whoever picks up the last stick wins.") print ("There are 13 stick(s) left.") print("how many sticks will you take?") print ("Player 1 ") totalSticks = 13 maxSticks= 4 minSticks = 1 #Loop until totalSticks > 0 while totalSticks > 0: sticksSelected= int (input()) #if stick is not in the given range ask user again while sticksSelected maxSticks: print("You cannot take", SticksSelected, "sticks") sticksSelected= int (input()) #you have to substract sticks selected by user totalSticks = totalSticks - sticksSelected #if totalsticks are less than maxSticks then change the maxSticks to totalSticks so that total sticks would not go in negative if totalSticks

it is not working right the introduction works okay however the game isn't working it supposed to start with

player 1 how many sticks will you select player 1 types in 4 and then it said there are 9 sticks left then it goes to player 2 how many sticks will you take player 2 types in 9 and that won't work and then player 2 type in 6 that won't work either and then player 2 types in 2 That leaves the message of there are 7 sticks left and then player 1 types in 1 leaving 6 and then player 2 types in 3 leaving 3 sticks and then player 1 types in 3 making player 1 the winner .

File Edit Shell Debug Options Windows Help Welcome to Pick Up Sticks. Each player takes turns picking up from 1 to 4 sticks from a pile of 13 Buicks. Whoever picks up the last stick wins. There are 13 sticka) lett. Player 1 - how many sticks will you take 4 There are 9 stick (3) lett

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

List the retirement income conversion options for an RRSP account?

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago