陷入了一段时间的真循环,我似乎无法打破

时间:2017-08-26 11:39:10

标签: python python-3.x

我陷入了一段时间的真循环,我似乎无法打破,请提出任何建议:

minstops = 1
maxstops = 100
minpass = 0
maxpass = 35

print ("Please enter the route number")
route = input()

print("Please enter number of stops on" , route,".")
stops = int(input())

while stops != "x":
    while True:
        if stops >= minstops and stops <= maxstops:
            break
        else:
            print ("Please enter a number between",minstops,"and",maxstops,".")

print ("Please enter the number of people already on",route,".")
numofpassonbus = int(input())

1 个答案:

答案 0 :(得分:0)

你需要一个x ==&#39; x&#39;当你给一个int来破坏第二个时,打破第一个while循环。我建议你尽量不要使用stop作为int和string。