Have a look at these geometric figures:
| A | B | C | D | E | F | 
|---|---|---|---|---|---|
They are all diamonds. Here are some similarities:
Now let's focus on their differences,
so we can figure out what parameters a diamond function should have.
def diamond(...) -> Graphic:We can see that the colors differ, so we want to have parameters to specify the four colors.
The diamonds also differ in size, so we want to have a parameter to specify e.g., the side length of a top triangle.
def diamond(side: float, darkest: Color, dark: Color, bright: Color, brightest: Color) -> Graphic:Try to create diamonds of different sizes and colors.
You may want to save your diamond function in your toolbox.
You never know when an opportunity comes up
to integrate a diamond into some more complex graphic.
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
Simple Diamond

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version 3ec0cab (Tue, 28 Oct 2025 16:56:29 GMT)