返回循环顶部
在 print("你没有那么多卡片!")
这行代码时,我希望这个循环能从
print("how many cards in heap no:", n, end="")
重新开始,而不是直接结束。这样该怎么做呢?
y = []
def cardHeaps():
global cards
n = 1
while int(cards) > 0:
print("how many cards in heap no:", n, end="")
x = int(input("? "))
cards = int(cards)
if x > cards:
print("you dont have that many cards!")
break
y.append(x)
cards -= int(x)
print(cards, " cards left")
n += 1
if cards <= 0:
print("out of cards!")
break