generated from mwc/lab_iteration
It was difficult to figure out how to write the
for-loop. I mostly figured it out with help. (checkpoint 1) I understand how to make the ranges well although it did take a bit to understand completely how to write them. (checkpoint 2)
This commit is contained in:
13
ranges.py
13
ranges.py
@@ -4,20 +4,23 @@
|
|||||||
|
|
||||||
def print_all_numbers(maximum):
|
def print_all_numbers(maximum):
|
||||||
"Prints all integers from 0 to maximum."
|
"Prints all integers from 0 to maximum."
|
||||||
for number in range(maximum):
|
for numbers in range(maximum):
|
||||||
print(number)
|
print(numbers)
|
||||||
|
|
||||||
def print_even_numbers(maximum):
|
def print_even_numbers(maximum):
|
||||||
"Prints all even integers from 0 to maximum."
|
"Prints all even integers from 0 to maximum."
|
||||||
pass
|
for numbers in range(0,maximum,2):
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
def print_odd_numbers(maximum):
|
def print_odd_numbers(maximum):
|
||||||
"Prints all odd integers from 0 to maximum."
|
"Prints all odd integers from 0 to maximum."
|
||||||
pass
|
for numbers in range(1,maximum,2):
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
def print_multiples_of_five(maximum):
|
def print_multiples_of_five(maximum):
|
||||||
"Prints all integers which are multiples of five from 0 to maximum."
|
"Prints all integers which are multiples of five from 0 to maximum."
|
||||||
pass
|
for numbers in range(0,maximum,5):
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
chosen_maximum = int(input("Choose a number: "))
|
chosen_maximum = int(input("Choose a number: "))
|
||||||
print(f"All numbers from 0 to {chosen_maximum}")
|
print(f"All numbers from 0 to {chosen_maximum}")
|
||||||
|
|||||||
Reference in New Issue
Block a user