Rangoli Sketch

By Rani Bhosale

        
Comments
Anand Chitipothu
2 years ago
Post
Dismiss
Nice work, Rani. Here are a suggestion to improve your program. The following code: ``` sinc = circle(x=89,y=0,r=5,fill="white",stroke="gold",stroke_width=5) show(sinc) for x in range(1,360,10): sinc1 = sinc | rotate(x) show(sinc1) ``` could have been written as: ``` sinc = circle(x=89,y=0,r=5,fill="white",stroke="gold",stroke_width=5) sinc1 = sinc | repeat(36, rotate(10)) show(sinc1) ``` The `repeat` function applies the `rotate(10)` transformation 36 times and reutrns the combined shape of all the results. It is not only easy to read, but also executes faster.
Nice work, Rani. Here are a suggestion to improve your program. The following code: ``` sinc = circle(x=89,y=0,r=5,fill="white",stroke="gold",stroke_width=5) show(sinc) for x in range(1,360,10): sinc1 = sinc | rotate(x) show(sinc1) ``` could have been written as: ``` sinc = circle(x=89,y=0,r=5,fill="white",stroke="gold",stroke_width=5) sinc1 = sinc | repeat(36, rotate(10)) show(sinc1) ``` The `repeat` function applies the `rotate(10)` transformation 36 times and reutrns the combined shape of all the results. It is not only easy to read, but also executes faster.
Want to discuss?
Post it here, our mentors will help you out.