陷入了一个真实的循环中,我似乎无法理解

2024-06-13 08:02:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我陷入了一个我似乎无法打破的真实循环,有什么建议吗

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())

Tags: andofthenumberinputonrouteint
1条回答
网友
1楼 · 发布于 2024-06-13 08:02:58

你需要一个x=='x'来打断第一个while循环,而你需要一个int来打断第二个while循环。我建议你尽量不要把stops用作int和string

相关问题 更多 >