GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — learn-python/src/control_flow/test_continue.py at master · BinaryDevil/learn-python

Expand file tree

/

test_continue.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
29 lines (20 loc) · 879 Bytes
/

test_continue.py

Copy path

File metadata and controls

29 lines (20 loc) · 879 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""CONTINUE statement
@see: https://docs.python.org/3/tutorial/controlflow.html
The continue statement is borrowed from C, continues with the next iteration of the loop.
"""
def test_continue_statement():
"""CONTINUE statement in FOR loop"""
# Let's
# This list will contain only even numbers from the range.
even_numbers = []
# This list will contain every other numbers (in this case - ods).
rest_of_the_numbers = []
for number in range(0, 10):
# Check if remainder after division is zero (which would mean that number is even).
if number % 2 == 0:
even_numbers.append(number)
# Stop current loop iteration and go to the next one immediately.
continue
rest_of_the_numbers.append(number)
assert even_numbers == [0, 2, 4, 6, 8]
assert rest_of_the_numbers == [1, 3, 5, 7, 9]
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.