Python syntax-control syntax

Repeat & conditional branch

count = 0
while count < 5:
    #Conditional branch
    if count % 2 == 0:
        print(str(count) + ' is even');
    else:
        print(str(count) + ' is odd');
    count += 1

Repeat 10 but skip 3 and exit with 5

for count10 in range(10):
    if count10 == 3:
        continue
    if count10 == 5:
        break
    print(count10)

Recommended Posts

Python syntax-control syntax
with syntax (Python)
Python control syntax (memories)
Python
Scraping using Python 3.5 Async syntax
Ruby and Python syntax ~ branch ~
#python Python Japanese syntax error avoidance
Python control syntax, functions (Python learning memo ②)
New syntax for Python 3.8 [assignment formula]
Compiler in Python: PL / 0 syntax tree
Python basics ⑤
python + lottery 6
Python Summary
Built-in python
Python comprehension
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python tips
python function ①
Python basics
ufo-> python (3)
Python comprehension
install python
Python Singleton
python memo
Python Jinja2
atCoder 173 Python
[Python] function
Python installation
python tips
Installing Python 3.4.3.
Try python
Python memo
Python algorithm
Python2 + word2vec
[Python] Variables
Python functions
Python sys.intern ()
Python tutorial
Python decimals
python underscore
Python summary
Start python
[Python] Sort
Note: Python
Python basics ③
python log
Python basics
[Scraping] Python scraping
Python update (2.6-> 2.7)
python memo
Python # sort
ufo-> python
Python nslookup
python learning
Hannari Python 2020
[Rpmbuild] Python 3.7.3.