Hey i been workn on this code for a few days now and im stuck!! i gotta make sum nested circles ... but the code i have here draws a bunch of circles but they are connected :'( and i tryed everythin T.up, T.forward, T.goto ... all of that .... can n e one help me please????

def drawPolygon(T, sidelen, numsides):
    turnAngle = 360 / numsides
    for i in range(numsides):
        T.forward(sidelen)
        T.right(turnAngle)



def drawCircle(T, radius):
    circumference = 2 * 3.1415 * radius
    sidelen = circumference / 360
    drawPolygon(T, sidelen, 360)



def draw_nested_circles(T, num_circles, min_rad):
    for radius in range(10, num_circles * 10+1, 10):
         drawCircle(T, radius)

You got to let us know what T is.

You got to let us know what T is.

T is the turtle object .. im using cTurtle to draw nested circles and i cant get the turtle to draw the circles nested .. they come out connected .. i kno i have to get the turtle to move so that after first circle is drawn, the next circle can be bigger and go over top of the first circle .. but im stuck

So you don't want the circles not to touch each other?
Something like this should do ...

# module cTurtle.py from:
# http://www.cs.luther.edu/~pythonworks/PythonContext/cTurtle.py
# (has nothing to do with C language)

import cTurtle as T

def drawPolygon(T, sidelen, numsides):
    turnAngle = 360 / numsides
    for i in range(numsides):
        T.forward(sidelen)
        T.right(turnAngle)


def drawCircle(T, radius):
    circumference = 2 * 3.1415 * radius
    sidelen = circumference / 360
    drawPolygon(T, sidelen, 360)


def draw_nested_circles(T, num_circles, min_rad, increment=10):
    pos = 0
    radius = min_rad
    for circle in range(num_circles):
        T.up()
        T.goto(0, pos)
        T.down()
        drawCircle(T, radius)
        pos += increment
        radius += increment


num_circles = 4
min_rad = 50
draw_nested_circles(T, num_circles, min_rad)

T.mainloop()  # keep canvas displayed option

So you don't want the circles not to touch each other?
Something like this should do ...

# module cTurtle.py from:
# http://www.cs.luther.edu/~pythonworks/PythonContext/cTurtle.py
# (has nothing to do with C language)

import cTurtle as T

def drawPolygon(T, sidelen, numsides):
    turnAngle = 360 / numsides
    for i in range(numsides):
        T.forward(sidelen)
        T.right(turnAngle)


def drawCircle(T, radius):
    circumference = 2 * 3.1415 * radius
    sidelen = circumference / 360
    drawPolygon(T, sidelen, 360)


def draw_nested_circles(T, num_circles, min_rad, increment=10):
    pos = 0
    radius = min_rad
    for circle in range(num_circles):
        T.up()
        T.goto(0, pos)
        T.down()
        drawCircle(T, radius)
        pos += increment
        radius += increment


num_circles = 4
min_rad = 50
draw_nested_circles(T, num_circles, min_rad)

T.mainloop()  # keep canvas displayed option

thanks man ... im new to programming and you really helped can you explain the (+=) and the (pos) and (goto) ......please?

pos += increment
is the same as
pos = pos + increment
it increases pos by the value in increment

goto(x, y) simply moves the turtle to a new loacation at coordinates (x, y)
goto(0, 0) is the center of the canvas in your case

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.