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