Python Forum
Procedure Not Executing - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Procedure Not Executing (/thread-6630.html)



Procedure Not Executing - jge047 - Dec-01-2017

Question - "Write code that draws a pattern with the turtle with at least 3 different colors used. The code must have a for loop and must have a if statement inside the for loop that changes the color."
In the below I can make it happen if I write out each step on line beneath color change. I am trying to be more efficient and use a procedure - but procedure does not execute. No errors, just turtle doesn't move. Thank you for any advice.
from turtle import *      
from sys import *         
setExecutionLimit(30000)  
space = Screen()          

width = 400               
space.setup(width,width)  
maxX = width / 2          

jazze = Turtle()
jazze.shape('turtle')
jazze.penup()
jazze.pensize(3)

 
def drawLine():
    jazze.goto(-1 * maxX,x * 10)      
    jazze.pendown()                  
    jazze.forward(width)   

for x in range(10):    
    if x % 3 == 0:                   
        jazze.color('red')
        drawLine
    elif x % 3 == 1:                  
        jazze.color('black')
        drawLine   
    elif x % 3 == 2:                   
        jazze.color('green')
        drawLine



RE: Procedure Not Executing - buran - Dec-01-2017

OP removed post content as he found a solution.

I reverted your post back - we don't delete post/remove post content. It would be nice if you can share the answer you have found for the benefit of other users who may look for solution of the same/similar problem.