我如何让我的程序只输出它在49号方格而不是54号等等。例如我在54号但是我只想让程序告诉我我在49号空间。
if dice1!=dice2:
print("You are now on space", position+total)
position=total+position
if position>=49:
print("You are on space 49")
if position<=0:
print("You are on square 0")
答案 0 :(得分:0)
以下是:
if position >= 49: #if the value is 54, this would default to 49.
print('You are on space 49, game over!')
else:
break
否则:
if position == 49: #this would require the position to exactly equal an integer of 49.
print('You are on space 49, game over!')