From 83c6dd5931a9c41a16bc00a428a50b6b3b6442b5 Mon Sep 17 00:00:00 2001 From: Seoyeon Lee Date: Fri, 20 Sep 2024 19:13:19 -0400 Subject: [PATCH] checkpoint 2 was much easier than checkpoint 1. It was intersting that maximum does not really include the maximum number I intended to have, so I revised maximum by adding plus 1, and this allowed me to have the maximum number I planned to have in outcome page. I did not feel I was struggling with checkpoint 2, I am still processing checkpoint 1 question though. --- ranges.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ranges.py b/ranges.py index 2fa00d7..2430e52 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+1, 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+1, 5): + print(number) chosen_maximum = int(input("Choose a number: ")) print(f"All numbers from 0 to {chosen_maximum}")