This article briefly summarizes how to use the while statement.
while conditional expression:
Statement to execute when the conditional expression is true
Write.
When the conditional expression becomes true The expression in the while block It will be executed in order.
The while statement is While the conditional expression is true, The process is repeated indefinitely.
So Make sure that the iterative process ends Let's think about the formula inside!
while.else With while.else Enforce when the conditional expression becomes false You can write an expression.
while conditional expression:
Statement to execute when the conditional expression is true
else:
Statement to execute when the conditional expression is false
Don't forget the :.
https://www.javadrive.jp/python/for/index1.html
Recommended Posts