Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n=int(input("How many marbles to start with? "))
- p=n
- switch = 1
- while p > 0:
- if switch==1:
- a = int(input('Player #1, there are ' + str(p) + ' marbles left. How many marbles will you take? '))
- p = p - a
- switch = 0
- else:
- a = int(input('Player #2, there are ' + str(p) + ' marbles left. How many marbles will you take? '))
- p = p - a
- switch = 1
- print('Player #' +str(switch +1)+', you took the last marble and have won!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement