Add for loop to loops demo

This commit is contained in:
Junior 2024-06-05 21:17:02 -04:00
parent 8beeb25522
commit 11da8437fa

View File

@ -11,4 +11,20 @@ while number <= 10:
print(f"Number: {number}")
number = number + 1
# The range(start, end) function returns
# numbers starting with "start" and ending
# one number before "end".
# range(0, 10) will return numbers from 0 to 9
# This is a "for" loop. For loops are used to
# iterate over lists or other collections of data.
# To iterate means to walk through a set of data
# one element at a time. A for loop lets you walk
# through a collection of data and do something
# with each element of that collection.
print("Numbers:", end='')
for num in range(0, 10):
print(f" {num}", end='')
print()
print()