generated from mwc/lab_iteration
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?
This commit is contained in:
parent
2e94868b5a
commit
fcee80c21e
|
@ -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}")
|
||||
|
|
Loading…
Reference in New Issue