Lecture 38: Python while loop statement core concept and case demonstration

1. The concept of loop statement

Loop refers to the repeated execution of certain actions according to specific conditions. In Python, loop operations are also called traversal operations. Just like in reality, Python can also implement infinite loops and limited loops according to specific conditions.

So why use a loop?

We can look at such a scenario: if we want to print 100 numbers from 1 to 100, if we don’t use loops, we need to write print statements 100 times by hand, and if we want to print 1000 data from 1 to 1000, we also need to write 1000 times by hand print statement.

print(

Guess you like

Origin blog.csdn.net/weixin_44953658/article/details/130360329