Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
0
crescent-rings-3D?
By
Hardik Prajapati
Run
def manage_colors(strategy=None): red_yellow = ["Gold", "DarkRed", "Yellow", "Crimson"] red_blue = ["DarkRed", "Red"] index = 0 def cycle_colors_red_yellow(): nonlocal index c = red_yellow[index] index += 1 index %= len(red_yellow) return c def cycle_colors_red(): nonlocal index c = red_blue[index] index += 1 index %= len(red_blue) return c if strategy=="red": return cycle_colors_red else: return cycle_colors_red_yellow cycle_colors = manage_colors(strategy="red") r = 300 diff = 10 shape = circle(r=r, fill="black") # initial background shape while(r > 0): c = cycle_colors() r -= diff if ((r // diff) % 2 == 1): x = 0 else: x = diff shape += circle(r=r, x=x, fill=c, stroke=c) show(shape)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login