generated from mwc/lab_iteration
	I rewrote the code to create an iteration by defining
square, then creating a repetition of side_length so that the square repeats itself Checkpoint 1 - It was challenging to rewrite the square. I tried many different variations but missed the list of side_length. Eventually, I had help from Emma who sent me a link to the walkthrough of the lab. THEN it made sense! : )
This commit is contained in:
		
							
								
								
									
										14
									
								
								square.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								square.py
									
									
									
									
									
								
							@@ -1,15 +1,11 @@
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
    side_lengths = [side_length, side_length, side_length, side_length]
 | 
			
		||||
    for side_length in side_lengths: 
 | 
			
		||||
        forward(side_length)
 | 
			
		||||
        right(90)
 | 
			
		||||
         
 | 
			
		||||
sizes = [20, 40, 60, 80, 100]
 | 
			
		||||
for size in sizes:
 | 
			
		||||
    square(size)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user