From 5129783b38974a45206748c2be53051a5012c80f Mon Sep 17 00:00:00 2001 From: Hope Date: Sat, 3 May 2025 14:26:54 -0400 Subject: [PATCH] used the min, max, stride function and added one to the max so it accounts for starting at 0. I struggled a little with figuring out where to start my count on the odd and even. I now understand it though after trying it wrong and updating it to work. --- ranges.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ranges.py b/ranges.py index 2fa00d7..6faec2b 100644 --- a/ranges.py +++ b/ranges.py @@ -4,20 +4,23 @@ def print_all_numbers(maximum): "Prints all integers from 0 to maximum." - for number in range(maximum): + for number in range(maximum+1): print(number) def print_even_numbers(maximum): "Prints all even integers from 0 to maximum." - pass + for number in range(0,maximum+1,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+1,5): + print(number) chosen_maximum = int(input("Choose a number: ")) print(f"All numbers from 0 to {chosen_maximum}")