From 70b1c4b1c868595691af9842d1416c23fb05852b Mon Sep 17 00:00:00 2001 From: jwberent Date: Thu, 11 Sep 2025 17:50:59 -0400 Subject: [PATCH] I changed the print_even_numbers, print_odd_numbers, and print_multiples_of_five functions and made them work. I used the range function to make them do what they are supposed to do. Checkpoint 2: - I think it is interesting that range does not take the last value. For example, range(0,100) will return the numbers 0 to 99. - I am unsure if ranges can be used with lists. I am not sure if they can be used together. --- ranges.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ranges.py b/ranges.py index 2fa00d7..1f137e7 100644 --- a/ranges.py +++ b/ranges.py @@ -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(5,maximum,5): + print(number) chosen_maximum = int(input("Choose a number: ")) print(f"All numbers from 0 to {chosen_maximum}")