begin_fill and end_fill don't take any arguments. You can specify fill color as the second argument to turtle.color. Additionally, begin_fill and end_fill should go outside the loop, because they should be called once per polygon rather than once per line. side_number = int(input("How many sides should the polygon have?")) side_length...

You need to draw the column after choosing the colour: def fillColor(t,height): if height >=200: t.fillcolor("red") elif height >= 100 and height < 200: t.fillcolor("yellow") else: t.fillcolor("green") drawBar(t,height) (The first column was black because that is the default fillcolor.)...

In the if statement, you should first turn, then go forward: Suppose you are at (0,299), and the turtle is facing up, you will go forward (let's say 100), then turn (let's say left). You will then be at (0, 399), facing left. You will then go in the else...

Yes, you can iterate over your Turtle instances, for example by putting them into a list and looping over it: for turtle_instance in [a, b, c, d]: turtle_instance.setpos(...) In fact, it is probably easier to start with them in a list: turtles = [Turtle() for _ in range(4)] # see...

You can use set xcor ... and set ycor ..., or setxy ... ..., or any other turtle motion command such as fd or bk, to position the turtle however you like. If the turtle's coordinates are both integers, it's on a patch center. If either or both aren't integers,...

You can call the font function to set up a different font before calling text. Here are some example calls: font("serif") -- change font font(32) -- change size font("italic") font("serif 32") -- or change both text("Text") Or in your code example: io.write("Enter the time in seconds that the timer will...

You need to figure out the extent of the region defined by the square so you can compare mouse-click positions to it later and see if they're inside it or not. Here's a complete program that first allows the lower-left corner of the square to be defined by a click,...

The turtle module does have support for images, but only GIF images, not PNG or any other format. As the docs for addshape say: name is the name of a gif-file and shape is None: Install the corresponding image shape. And if you look at the source, they're serious about...

As Brian states, you will probably want to choose a potential buyer and potential seller (so the sellers don't run out of goods etc). However, if you really want all buyers to buy from all sellers with a suitable price, you want code that uses 'myself' to access the variables...

Method 1 You are simply importing the package turtle and as you may already know, you are unable to use a variable that has not been declared. Thus, you must reference every item with the package name as a prefix like turtle.Pen or turtle.Turtle. Method 2 You are not importing...

Some important things to note: turtle.pendown() does not change the particular instance or race, you want race.pendown() Each time you do race = turtle.Turtle(), you make a new instance of race Take this statement out side of the for loop. Each loop you make you need to move race (for...

You need to specify your forward commands so the turtle starts at the center of the line, and draws one half of the line in front of it and one half behind it. Like this: def drawI(depth, size): if(depth < 1): pass else: #draw the half in front of the...

For circle in range(num, 0, -1):90 (num..1) In For Condition “:” is a must to Indicate the start of the loop, For circle in range(num, 0, -1): #(num..1) Your variable num is not defined as well, Assuming you have misplaced it with variable n. This will give you concentric...

Depending on the values of initialLength and multiplier, it is very possible that your function will never be exactly 1. You check for this right here: if initialLength == 1 or newLength ==1: up() If it never reaches exactly one, the turtle will never stop drawing. Try changing it to:...

Generally, yes, you do want to avoid using the form from module import *. That that does is that it opens up the module (a normal python file), and essentially takes every function, class, etc. defined within that file and adds it to your namespace. And you're right -- *...

It's still turtle.mainloop(), not wn.mainloop(). I suspect the reason for this is since you can make multiple screens, it makes sense to still have the turtle module manage all of the screens instead of trying to potentially make multiple mainloops work together....

First, you need to define some functions that we will use to define the operations of your turtle object: def forward(): turt.forward(30) def left(): turt.left(90) def right(): turt.right(90) Next, we need to create a dictionary mapping the string keys to the functions that we had just defined: map = {'F':...

So you're making a turtle t, then completely ignoring it and passing to drawRectangle a turtle (?) that you have actually never made at all. Obviously, you'll need to pass to the function exactly the turtle you have made, not another! Moreover, the color and fillColor you've set on the...

If you want to iterate over separations: def droplets(t, size, separations): for i in range(len(separations)): t.down() t.circle(size) t.up() t.forward(separations[i]) Or, more simply, just iterate over separations instead of using indexes: def droplets(t, size, separations): for separation in separations: t.down() t.circle(size) t.up() t.forward(separation) ...

It looks like each draw_leaf call begins when the turtle is at the far end of the leaf that it just previously drew. So the polygon that is filled during the current draw_leaf includes that end point. This is more apparent if you draw each leaf with a different color....

The example invocation you posted (spiral( 100, 90, 0.9 )) seems to treat the second parameter as the degree of each turn whereas you treat it as the number of turns to make a complete 360 degree turn in your code. Either change the call to spiral(20, 4, 0.9) or...

You could try something like this from turtle import * def drawcircles(circum): #multiples of 10 while circum > 0: circle(circum) circum -= 10 penup() left(90) forward(10) right(90) pendown() drawcircles(50) exitonclick() I draw a circle, reset the position and draw again, the only catch with this code is that the circumference...

You have to find the perimeter first, then divide it by the total number of rotations, then set that as the value of forward in your loop. E.g. make "d 100 make "p 3.141592654*:d make "i :p/36 repeat 36[fd :i rt 10] you can have all of them in a...

I think you've actually got a wider confusion here. The initial error is that you're trying to call split on the whole list of lines, and you can't split a list of strings, only a string. So, you need to split each line, not the whole thing. And then you're...

I think you may have some misunderstanding with regard to some of the functions in the turtle library. Firstly, turtle.window_height() and turtle.window_width() return the height and width of the window, so (as these values are not being assigned) those two lines do nothing. Similarly, turtle.Screen() returns an object, so again...

y = 50*(math.sin(math.radians(x))) with x in the range from min to max will of course produce the corresponding graph, if (min,max)=(0,300) then from sin(0) to sin(300*pi/180). (x-min)/(max-min) will produce a variable in the range of 0 to 1 -1+2*(x-min)/(max-min) correspondingly a variable in the range from -1 to 1. So...