Python Forum
Thread Rating:
  • 3 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Procedure Not Executing
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python script is hanging while calling a procedure in database prasanthi417 4 442 Jan-17-2024, 02:33 PM
Last Post: deanhystad
  python call stored procedure mg24 2 1,032 Oct-18-2022, 02:19 AM
Last Post: mg24
  python call stored procedure with two parameter mg24 4 1,405 Sep-27-2022, 05:02 AM
Last Post: deanhystad
  capture print statement written in Stored Procedure in SQL Server brijeshkumar_77 0 2,516 Feb-18-2020, 03:22 AM
Last Post: brijeshkumar_77
  Execute SQL Server Stored Procedure brijeshkumar_77 0 2,979 Feb-18-2020, 02:59 AM
Last Post: brijeshkumar_77
  What do you think of this procedure to create a path to a folder atlass218 10 6,380 Sep-06-2019, 07:53 AM
Last Post: atlass218
  How to return value from a stored procedure of a MySQL database? UtiliseIT 0 2,300 Jul-22-2019, 10:14 AM
Last Post: UtiliseIT
  Add a stored procedure with variable using MySQL Connector UtiliseIT 0 2,267 May-04-2019, 12:46 PM
Last Post: UtiliseIT
  Unable to use sqlanydb to execute Sybase IQ Stored Procedure FORTITUDE 4 3,737 Sep-15-2018, 05:03 PM
Last Post: FORTITUDE
  Executing a MySQL Stored Procedure with variable UtiliseIT 0 4,913 Oct-28-2017, 04:35 AM
Last Post: UtiliseIT

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020