Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

Python help: A tick is a short line that is used to mark off units of distance along a line. Write a function named drawTick() that uses a turtle parameter to draw a single tick of specified length perpendicular to the initial orientation of the turtle. The function drawTick() takes two parameters: 1. a turtle, t, that is used to draw 2. an integer, tickLen, that is the length of the tick.

OpenStudy (anonymous):

here is my approach: import turtle s = turtle.Screen() def drawTick(t, tickLen): for num in range(tickLen): if num%2 == 0: t.forward(num) t.penup() t.forward(num) t.pendown() return drawTick length=100 turt=turtle.Turtle() tick = drawTick(turt, length)

OpenStudy (anonymous):

I can't seem to draw an equal set of lines.

OpenStudy (mathmate):

Hints: First, make a habit of rereading the question before you even start. The reason is that in order to give the proper context, questions tend to explain a lot, but ask you to do very little. ``` Write a function named drawTick() that uses a turtle parameter to draw a single tick of specified length ``` The above is what you're required to do. |dw:1442835739158:dw| So only a SINGLE tick is required, which is perpendicular to the original orientation of the turtle, which could be vertical or horizontal. ``` ...a single tick of specified length perpendicular to the initial orientation of the turtle. ``` |dw:1442835919067:dw| To draw the tick itself, you need to turn left/right 90 degrees, move forward tickLen/2 with pen up, then turn left/right 180 degrees to draw tickLen, turn left/right 180 again to go back to the initial position and turn right/left 90 degrees to regain the original position. Hope this helps you have an idea. Programming is an iterative art, meaning that there are many ways to do the same thing, some ways are more beautiful than the others, so your imagination is needed. Iterative because most people learn by experimenting, and few (if any) do what she wanted in the first try. Programming experience is enjoyable and unfortunately addictive!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!