[PYTHON] while statement

Introduction

This article briefly summarizes how to use the while statement.

How to create a 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 :.

reference

https://www.javadrive.jp/python/for/index1.html

Recommended Posts

while statement
Python Exercise for Beginners # 2 [for Statement / While Statement]
return statement
while else
Python if statement
Unfamiliar if statement
[PyQt] Guidance statement
Python with Progate (dictionary, while statement, break, continue)
while else block
[Introduction to Udemy Python3 + Application] 40.while else statement
For Else statement
Python exec statement
[Python] if statement
Python assert statement
A Java programmer studied Python. (for, if, while statement)