Ex33 skill drills

Can you tell me if this is a good representation of the skill drills for this exercise and an accurate explanation of my notes?

def while_loop(i, count, increment_by, numbers):
    #i = 0 #start count for i at zero
    #numbers = [] #define variable numbers as empty list

    while i < count:
        print(f"At the top i is {i}") #starts at zero befor first iteraton and increments
        numbers.append(i) # append i to the list in variable numbers

        i += increment_by  #i = i + 1 - If forget this statement, loop forever - unbounded. if statement bounded - increments count i
        print("Numbers now: ", numbers)#prints the variable numbers after each iteration is appended
        print(f"At the bottom i is {i}")#after first iteration i is 1 at the bottom

        print("The numbers: ")

        for num in numbers: #for loop iterates through variable numbers, stores in num, and prints contents of num
            print(num)


while_loop(2, 20, 2, [])#i is where count starts, count is the count ends, increment_by (how counts), [] starts empty list for numbers




#see this when do not want to end
#while True:
    #print("0000", end=" ")

I’ve noticed that in the for loop “print(f"At the bottom i is {i}”)" is different than the while loop.



def while_loop():
    #i = 0 #start count for i at zero
    numbers = [] #define variable numbers as empty list

    #while i < count:
    for i in range(2, 10, 2):

        print(f"At the top i is {i}") #starts at zero befor first iteraton and increments
        numbers.append(i) # append i to the list in variable numbers

        #i += increment_by  #i = i + 1 - If forget this statement, loop forever - unbounded. if statement bounded - increments count i
        print("Numbers now: ", numbers)#prints the variable numbers after each iteration is appended
        print(f"At the bottom i is {i}")#after first iteration i increments differentsly in a for loop

        print("The numbers: ")

        for num in numbers: #for loop iterates through variable numbers, stores in num, and prints contents of num
            print(num)


while_loop()
#i is where count starts, count is the count ends, increment_by (how counts), [] starts empty list for numbers

That’s looking alright for this stage of the book. I think you could tinker with this forever so I say move on. Also, when you post code, do this:

[code]
print("I am python code.")
[/code]

You can edit your post and add that the way I did on your first one. That will make the code easier to read.