I find them quite intuitive to understand.

I like that there are wayts to make the command even more useful, such as adding a start and end number, as well as what you wanna count by.

Overall, i dont think there is much I am confused about in terms of the command on its own.
I am interested in knowing more creatives ways to use range in bigger programs.
This commit is contained in:
mbhatti4
2025-09-16 17:04:00 -04:00
parent 6419e4e53e
commit de7995f309

View File

@@ -9,15 +9,18 @@ def print_all_numbers(maximum):
def print_even_numbers(maximum):
"Prints all even integers from 0 to maximum."
pass
for number in range(0,maximum,2):
print(number)
def print_odd_numbers(maximum):
"Prints all odd integers from 0 to maximum."
pass
for number in range(1,maximum,2):
print(number)
def print_multiples_of_five(maximum):
"Prints all integers which are multiples of five from 0 to maximum."
pass
for number in range(0,maximum,5):
print(number)
chosen_maximum = int(input("Choose a number: "))
print(f"All numbers from 0 to {chosen_maximum}")