# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

x = 21
if x % 7 == 0:
    print("yes")

x = 21
if x % 7 == 0:
    print("yes")
else:
    print("no")

x = 29
if x % 7 == 0:
    print("yes 7")
else:
    if x % 4 == 0:
        print("yes 4")
    else:
        print("no neither")

x = 29
if x % 7 == 0:
    print("yes 7")
elif x % 4 == 0:
    print("yes 4")
else:
    print("no neither")

my_list = [1, 3, 5]
for value in my_list:
    print("Here I am")
    print(value)

# First time through the loop
value = 1
print("Here I am")
print(value)
# Second time through the loop
value = 3
print("Here I am")
print(value)
# Third time through the loop
print("Here I am")
value = 5
print(value)

odd_numbers = [1, 3, 5, 7, 9]
# A variable to hold the running total of the numbers
total = 0
for value in odd_numbers:
    "Do something here"
    # If I print(total) here:
    #  The first time through the list I get 1
    #  The second time through the list I get 4 (1 + 3 == 4)
    #  The third time through the list I get 9 (4 + 5 == 9)
    #  The fourth time through the list I get 16 (9 + 7 == 16)
    #  The fifth time through the list I get 25 (16 + 9 == 25)
    total = total + value
    print("Value is", value, "current total is", total)
print(total)

# +
total = 0

# Now the loop, unrolled
value = 1
total = total + value
value = 3
total = total + value
value = 5
total = total + value
value = 7
total = total + value
value = 9
total = total + value
print(total)

StarcoderdataJupyterScriptsDedupFiltered