如果条件为假,如何返回第1行。
while True:
food = int(input("food bill: "))
if food <= 10:
print("please write more than 10")
#If i put break statement here it does not go forward
else:
carbill = int(input("carbill: "))
print("Total Montlhy expenditure is : " , grandtotal)
答案 0 :(得分:1)
这就是你想要的-
while True:
food = int(input("food bill: "))
if food <= 10:
print("please write more than 10")
continue
carbill = int(input("carbill: "))
print("Total Montlhy expenditure is : " , food+carbill)
答案 1 :(得分:0)
使用continue
,它将返回到循环指令(适用于for
)。