+
 新版

python 中while循环如何退出循环

leiline 发布于 2014/06/10 16:52
阅读 9K+
收藏 0
初学python自己写了一个while循环但无法退出循环,请大神帮忙解释解释
temp=1
while temp:
    print("-------地址换算过程-------")
    print("1.分页式地址换算")
    print("2.分段式地址换算")
    print("3.段页式地址换算")
    print("4.结束运行")
    print("------------------------")
    print("请输入您的选择:")
    temp=input()
    if temp==1:
        pass
    elif temp==2:
        pass
    elif temp==3:
        pass
    elif temp==4:
        break

print("程序结束")



加载中
0
osc_63620855
osc_63620855

或者直接用汉字一二代替,就不用加int转换😜

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部