<jupyter_start><jupyter_text>While loops continue to execute a block of code while some condition remains TrueSynax of a while loopwhile some_boolean_condition:    do something        else:        do something different<jupyter_code># create a while loop
x = 0 #create a var
while x < 5: # while this condition is true:
    # run this block of code
    print(f'The current value of x is {x}')
    x += 1 # add 1 to x everytime while loop is running
    # if condition does not change an infinite while loop will be created
else:# if condition is not true
    print(f'x is not less then 5 no more')<jupyter_output>The current value of x is 0
The current value of x is 1
The current value of x is 2
The current value of x is 3
The current value of x is 4<jupyter_text>BREAK CONTINUE PASSWe can break, continue, and pass statements in the loops to add additional functionality for various casesbreak: Breaks out the current closest enclosing loopcontinue: Goes to the top of the closest enclosing looppass: Does nothing at all<jupyter_code># using pass in a for loop

x = [1,2,3]

for item in x :
    pass # dont want the program to crash use 'pass' as a filler to avoid error
# using continue in a for loop
my_string = 'Sammy'

for letter in my_string:
    if letter == 'a':
        continue # if the letter is a restart the loop
    print(letter)
# using break with an while statement which is more common
x = 0
while x < 5 :
    if x == 3:
        break # use break to break out the whole loop when condition is met
    print(x)
    x += 1<jupyter_output>0
1
2
{'fraction_non_alphanumeric': 0.05128205128205128, 'fraction_numerical': 0.01282051282051282, 'mean_word_length': 3.434659090909091, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '37071', 'license': 'Unlicense', 'n_tokens_mistral': 471, 'n_tokens_neox': 450, 'n_words': 251, 'path': 'WhileLoops.ipynb', 'repo_name': 'MarcusDMelv/Python-Control-Flow', 'size': '1560'}