python怎么回到开头_python-3.x
我有⼏个if语句,但是如果第⼀个输⼊为fal,它仍将继续执⾏下⼀个if语句,⽽不是回到该if语句的开头并重新开始。下⾯的代码
lookafter# check the weight of a single parcel英语练习题
while True:
the mythpweight = float(input('How much does your parcel weigh in kg? '))
if pweight > 10:
print('Sorry the parcel is to heavy')
elif pweight < 1:
2020高考试题
print('Sorry the parcel is to light')
el:
青藏铁路英语break
print('----------------------------------------------')
while True:
height1 = float(input('Enter the parcel height in cm: '))
3266if height1 > 80:
print('Sorry, Your height is too large')
esxel:
break
print('----------------------------------------------')
while True:英语台词
width1 = float(input('Enter the parcel width in cm: '))
if width1 > 80:
print('Sorry, Your width is too large')
el:
break
print('----------------------------------------------')
while True:
length1 = float(input('Enter the parcel length in cm: '))
if length1 > 80:
print('Sorry, Your length is too large')
el:
break
print('----------------------------------------------')eagleeye
while True:
回应英语
if (height1 + width1 + length1) > 200:
print('Sorry, the sum of your dimensions are too large')
el:
print('Your parcels dimensions are', height1, 'x', width1, 'x', length1)
print('Your parcel has been accepted for delivery, many thanks for using our rvice :)')
break
例如,如果输⼊的体重是11或⾝⾼⼤于80,则应始终回到起点并询问体重。 **如果没有满⾜任何条件,我需要重新回到开始并要求重量。**程序应重新启动并再次询问重量。