From fcee80c21e09b26b652e33c1b923f1fe9965c13c Mon Sep 17 00:00:00 2001 From: Rebecca Hankey Date: Thu, 12 Sep 2024 21:32:50 -0400 Subject: [PATCH] Using the example as a model, I changed the range function in each iteration to fit the prompt. The first two were similar with different starting points. Then the final example had a change to the stride as well. Ranges made a lot of sense to me. I think it might have to do with the concrete nature of the function. I really liked the use of the stride factor. It seems like something that would be helpful in a lot of differnt cases, but with minimal changes to the function. In short I like the versitility. One thing I am unsure about with ranges is if they are applicable in instances such as the dawing lab. If they are countihng numbers, can they be used to create physical representations of things? Or are they more usable in numerical senses? --- ranges.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ranges.py b/ranges.py index 2fa00d7..6b915c9 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(0, maximum, 5): + print(number) chosen_maximum = int(input("Choose a number: ")) print(f"All numbers from 0 to {chosen_maximum}")