"Python Basics" process controls-while Loops

Source: Internet
Author: User
#while循环‘‘‘while 条件判断: 满足条件执行的代码 ...条件判断的根本是True和False的判断 True才会执行 False不会执行通过一下方法来打印条件是True或者False a = 10 b = 20 print(a > b) print(b > a)‘‘‘# 值条件判断:# a = 3# b = 5# 正常条件判断# while a > b:# print("啦啦啦")# 死循环# while True:# print("啦啦啦")#打印1-50数字到终端‘‘‘方法一:直接使用条件判断‘‘‘# count = 1# while count <=50:# print(count)# count+=1 #其实等同于count=count+1‘‘‘方法二:直接修改标签的方法‘‘‘# condition = True# count = 1# while condition:# print(count)# count+=1# if count > 50:# condition = False

"Python Basics" process controls-while Loops

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.