python中while循环

2021-06-11 13:05

阅读:566

标签: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


评论


亲,登录后才可以留言!