Light House

By Gayatri

        
Comments
Anand Chitipothu
9 months ago
Post
Dismiss

Nice sketch!

Couple of suggestions: - use space on the both side of plus to make it easier to read the code - always use a space after a comma - don't write too long lines. That makes the code hard to read again. One approach to handle that is to break that into multiple lines as shown below:

c =  (
    rectangle(w=300, h=50, y=125, fill="black") +
    rectangle(w=300, h=50, y=75, fill="#111E6C" ) + 
    rectangle(w=300, h=50, y=25, fill="#0B2080", stroke="none") +
    rectangle(w=300, h=50, y=-25, fill="#1034A6", stroke="none") +
    rectangle(w=300, h=50, y=-75, fill="#0F52BA", stroke="none") +
    rectangle(w=300, h=50, y=-125, fill="#2380FB", stroke="none"))

When someone looks at this code, they immediately know that you are drawing six rectangles.

Want to discuss?
Post it here, our mentors will help you out.