generated from mwc/lab_iteration
	I added loops that were similar to the given ex.
Checkpoint 1: - It wasn't really difficult. I initially wrote the loop based on the number of sides the square has but then noticed the input was size dependent and not shape. So I just used the number of inputs for the loop. Checkpoint 2: - I think the concept of range and the related function we use is pretty simple and I understood it pretty well overall. - My mind briefly wandered off to series while writing the odd function. I could probably figure out why that connection popped up in my mind and how to implement it if asked but it wasn't needed for this time. Checkpoint 3: - I definitely will utilize docstrings along with whitespaces to help making the code more legible and easier to follow. This doesn't only benefit people who are unfamiliar with my code but also it benefits me to keep track of my thoughts if I ever were to take a break from, or foresee editing my code.
This commit is contained in:
		@@ -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}")
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								square.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								square.py
									
									
									
									
									
								
							@@ -1,17 +1,10 @@
 | 
			
		||||
from turtle import *
 | 
			
		||||
 | 
			
		||||
def square(side_length):
 | 
			
		||||
    forward(side_length)
 | 
			
		||||
    right(90)
 | 
			
		||||
    forward(side_length)
 | 
			
		||||
    right(90)
 | 
			
		||||
    forward(side_length)
 | 
			
		||||
    right(90)
 | 
			
		||||
    forward(side_length)
 | 
			
		||||
    right(90)
 | 
			
		||||
 | 
			
		||||
sizes = [20, 40, 60, 80, 100]
 | 
			
		||||
for size in sizes:
 | 
			
		||||
        forward(side_length)
 | 
			
		||||
        right(90)
 | 
			
		||||
square(size)
 | 
			
		||||
input()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user