program should display something like this:
Welcome to the game of nuts!
How many nuts are there on the table initially (10-100)? 10
There are 10 nuts on the board.
Player 1: How many nuts do you take (1-3)? 3
There are 7 nuts on the board.
Player 2: How many nuts do you take (1-3)? 3
There are 4 nuts on the board.
Player 1: How many nuts do you take (1-3)? 3
There is 1 nut on the board.
Player 2: How many nuts do you take (1-3)? 2
Player 2, you lose.
what I did was:
introduction="Welcome to the game of nuts!"
print(introduction)
x= input("How many nuts are there on the table initially(10-100)?")
print("There are "+x+" nuts on the board.")
remaining=int(x)
while remaining>0:
player=input("Which Player?")
if player=="1":
value=int(input("Player"+player+": How many nuts do you take (1-3)?"))
else:
value=int(input("Player"+player+": How many nuts do you take (1-3)?"))
while 1<=value<=3:
remaining= int(remaining)- value
remaining=str(remaining)
print("There are "+remaining+ " nuts on the board.")
but my output is a continuous loop
I m very lost please help
Welcome to the game of nuts!
How many nuts are there on the table initially (10-100)? 10
There are 10 nuts on the board.
Player 1: How many nuts do you take (1-3)? 3
There are 7 nuts on the board.
Player 2: How many nuts do you take (1-3)? 3
There are 4 nuts on the board.
Player 1: How many nuts do you take (1-3)? 3
There is 1 nut on the board.
Player 2: How many nuts do you take (1-3)? 2
Player 2, you lose.
what I did was:
introduction="Welcome to the game of nuts!"
print(introduction)
x= input("How many nuts are there on the table initially(10-100)?")
print("There are "+x+" nuts on the board.")
remaining=int(x)
while remaining>0:
player=input("Which Player?")
if player=="1":
value=int(input("Player"+player+": How many nuts do you take (1-3)?"))
else:
value=int(input("Player"+player+": How many nuts do you take (1-3)?"))
while 1<=value<=3:
remaining= int(remaining)- value
remaining=str(remaining)
print("There are "+remaining+ " nuts on the board.")
but my output is a continuous loop
I m very lost please help