python3中的while语句、if语句
生活随笔
收集整理的這篇文章主要介紹了
python3中的while语句、if语句
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
a = 1
while a <= 7:if a % 2 == 0:print(str(a) + " is even.")else:print(str(a) + " is odd.")a += 1
輸出結果是:
r@r-Sys:~/python$ python3 4.py 1 is odd. 2 is even. 3 is odd. 4 is even. 5 is odd. 6 is even. 7 is odd.?
總結
以上是生活随笔為你收集整理的python3中的while语句、if语句的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python 条件语句 学习转载
- 下一篇: websocket python爬虫_p