How to use whilestatement to realize Loop in Python
This article is to share with you about how to use the whilestatement in Python to achieve a loop. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
I. While statement
What is a cycle?
A loop is simply understood as doing something over and over again.
Format:
While condition judgment:
When the judgment condition (True) is satisfied
Multiple execution statements
The result of conditional judgment: True or False
If True, the code inside the while statement module is executed
If False, then it will not enter the inside of the while statement
Note:
Boolean value with uppercase initials
Because the python language is case sensitive.
II. Cases
Output all numbers between 1 and 100:
Xero1
While x