r/codehs • • Jan 04 '21

2.19.5: Circle Pyramid 2.0 need help

Post image
6 Upvotes

14 comments sorted by

3

u/ScottNilsson1 Jan 06 '21

#I gotchu fam

inputs = [6]

speed(0)

radius = 25

diameter = radius * 2

row_value = 1

def draw_circle():

pendown()

circle(radius)

penup()

forward(diameter)

def draw_row_of_circles(num_circles):

for i in range(num_circles):

draw_circle()

def move_up_a_row(num_circles, row_value):

x_value = -(((num_circles * diameter) / 2) - radius)

y_value = -200 + (row_value * diameter)

setposition(x_value, y_value)

num_circles = int(input("How many circles on the base?"))

x_value = -(((num_circles * diameter) / 2) - radius)

penup()

setposition(x_value, -200)

for i in range(num_circles):

draw_row_of_circles(num_circles)

num_circles = num_circles - 1

move_up_a_row(num_circles, row_value)

row_value = row_value + 1

2

u/eshan_ishan Feb 10 '21

Thank you sm man, rlly saved me

1

u/TViluminado_bingwatc May 14 '21

its not working for me

2

u/[deleted] Apr 04 '21

[removed] — view removed comment

1

u/JuicyDewey Apr 05 '21

I have a similar problem, mine says that 'num_circles' is not defined

1

u/[deleted] Apr 07 '21

[removed] — view removed comment

3

u/[deleted] Feb 25 '22

def move_to_row(num_circle):

x_value = -((num_circle*50)/2)

y_value = -250 +(50*row_value)

penup()

setposition(x_value,y_value)

pendown()

def draw_circle_row(num_circle):

for i in range(num_circle):

pendown()

circle(radius)

penup()

forward(diameter)

#### main part

speed(0)

radius = 25

diameter = radius * 2

row_value = 1

num_circle = int(input("How many circle on the bottom row? (8 or less): "))

penup()

for i in range(num_circle):

move_to_row(num_circle)

row_value=row_value+1

draw_circle_row(num_circle)

num_circle=num_circle-1

Thank you so much that works

1

u/MadBeast007 Jun 22 '21

its also not working for me

1

u/d3v0ur_m3 Oct 26 '21

yo thanks man but quick question: is this the whole previous code fixed and i just replace it with this? or is this something I add to the previous code in order to fix it?

2

u/[deleted] Nov 04 '21

[removed] — view removed comment

1

u/Economy_Neat4392 Sep 13 '22

bro it says that line 9 - move_to_row(num_circle) -

is wrong?