GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — learn-python/src/control_flow/test_continue.py at master · SAIVINODMS/learn-python Expand file tree/ Copy pathtest_continue.pyMore file actions 29 lines (20 loc) · 879 Bytes / Copy pathtest_continue.pyFile metadata and controls29 lines (20 loc) · 879 Bytes 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. |