码迷,mamicode.com
首页 > 编程语言 > 详细

python中while循环

时间:2021-01-05 11:31:35      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:pre   int   print   color   循环   please   inpu   rgba   code   

 

1、

>>> a = ""
>>> while a != "quit":
    a = input("please input a str or ‘quit‘ to leave: ")
    print(a)

    
please input a str or quit to leave: 100
100
please input a str or quit to leave: abc
abc
please input a str or quit to leave: quit
quit

 

2、

>>> a = ""
>>> while a != "quit":
    a = input("please input a str or ‘quit‘ to leave: ")
    if a != "quit":
        print(a)

        
please input a str or quit to leave: 200
200
please input a str or quit to leave: abc
abc
please input a str or quit to leave: quit
>>> 

 

python中while循环

标签:pre   int   print   color   循环   please   inpu   rgba   code   

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14222524.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!