[Tutor] (no subject)
robertvstepp at gmail.com
Sat Oct 27 12:11:20 EDT 2018
On Sat, Oct 27, 2018 at 6:48 AM Jesse Stockman
<angel.purr.bott at gmail.com> wrote:
> Hi there
> I need to draw a patten with turtle in python 3.7 but I cant get it to work ...
What is the problem? Describe what you expected to happen, what did
happen, and *copy and paste* the Traceback that Python generates. I
had a bit of time, so I ran your code as you had it in your email, and
I got the following:
Traceback (most recent call last):
File "draw_body.py", line 69, in <module>
File "draw_body.py", line 26, in main
draw_podium(winner_color, second_color, third_color)
NameError: name 'draw_podium' is not defined
If you look at your code, your main() function calls this
draw_podium() function, but you never give us that function in your
email. Likewise, darw_third() [Note the spelling error here.],
draw_winner(), and draw_second() are not defined anywhere in the code
you provided. Looks like your next step is to write those functions.
BTW "hight" should be "height", but as long as you are consistent,
that spelling error should not cause any issues.
One thing you can do to check for further issues with the code you
*have* written so far, is to provide the missing functions with "pass"
in each function's body, and then run your program and see if any
other errors emerge. E.g.,
draw_podium(winner_color, second_color, third_color):
Hope this helps!
> ...here are the specs of the pattern and my code so far can you please help
> • Specifications of the pattern o The radius of the three heads is 10.
> o The length of legs is 30. o The length of the sizes of the two triangles (the body of runner-up and third-place) is 40. They are all equal-size triangles. The winner’s body is a 40x40 square. o The width of the three blocks of the podium is 60. The heights are 90, 60, and 40 respectively.
> And my code so far
> from turtle import *
> x = 0
> y = 0
> radius = 0
> x1 = 0
> x2 = 0
> y1 = 0
> y2 = 0
> color = 0
> width = 0
> hight =0
> def main():
> winner_color = "red"
> second_color = "orange"
> third_color = "purple"
> draw_podium(winner_color, second_color, third_color)
> def move_to(x, y):
> x = int(input("input X coordinate: "))
> y = int(input("input y coordinate: "))
> goto(x, y)
> def draw_head(x, y, radius):
> radius = int(input("input radius: "))
> move_to(x, y)
> def draw_line(x1, y1, x2, y2):
> x1 = int(input("line start X: "))
> y1 = int(input("line start Y: "))
> x2 = int(input("line end X: "))
> y2 = int(input("line end Y: "))
> def draw_block(x, y, hight, width, color):
> move_to(x, y)
> hight = int(input("input hight: "))
> width = int(input("input width: "))
> draw_block(x, y, hight, width, color)
More information about the Tutor