generated from mwc/lab_iteration
For the ranges.py submission, it was actually
quite simple to figure out the proper ranges for setting up the python file. I started by copying over the function from "print_all_numbers" and modified the parameters for each additional function. It was a rare circumstance where the first try was completely correct.
This commit is contained in:
parent
3321e77c06
commit
38e1a0349f
|
@ -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}")
|
||||
|
|
Loading…
Reference in New Issue