<jupyter_start><jupyter_text>Python Reference - While-Loop**Author:** <NAME> Definitionone of the basic loops in programming Links  -  whilethe python **while** loop works the same as in C<jupyter_code>lo, hi = 0, 5
while lo < hi:
    lo = lo + 1
print(lo)<jupyter_output>5<jupyter_text>break  **while** loops can have a **break** too<jupyter_code>lo, hi = 0, 5
while lo < hi:
    lo = lo + 1
    if lo == 3:
        break
print(lo)<jupyter_output>3<jupyter_text>else  **while** loops can have an **else** statement that is executed if the loop finished without hitting a **break**<jupyter_code>lo, hi = 0, 5
while lo < 10:
    lo = lo + 1
    if lo == 11:
        print("lo > hi")
        break
else:
    print("lo == hi")<jupyter_output>lo == hi<jupyter_text>skipuse **continue** to skip a loop cycle<jupyter_code>i = 0
while i < 4:
    i += 1
    if i == 2:
        continue
    print(i)<jupyter_output>1
3
4
{'fraction_non_alphanumeric': 0.13062568605927552, 'fraction_numerical': 0.025246981339187707, 'mean_word_length': 3.4057971014492754, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '262915', 'license': 'MIT', 'n_tokens_mistral': 359, 'n_tokens_neox': 335, 'n_words': 109, 'path': 'Loops/While.ipynb', 'repo_name': 'Architect0711/PythonReference', 'size': '919'}