створити орнамент у Python згідно запиту користувача (126.). тобто, виконавець питає: 1.3 яких фігур створити орнамент? 2. якого розміру фігури? 3. зі скількох фігур створити орнамент? 4. яке зміщення фігур? всі відповіді користувача виконавець записує у змінні, і згідно введених значень користувача виконавець малює орнамент.
Срочно надоДаю 50 баллов
Ответы на вопрос
Ответ:
Here is the Python code to create an ornament according to the user's request:
```python
import turtle
# Ask the user what shapes to create an ornament
shape = input("What shape do you want to create an ornament with? (circle, square, triangle): ")
# Ask the user the size of the shape
size = int(input("What size do you want the shape to be? "))
# Ask the user how many shapes to create an ornament
num_shapes = int(input("How many shapes do you want to create an ornament with? "))
# Ask the user the offset of the shapes
offset = int(input("What is the offset of the shapes? "))
# Create a turtle object
t = turtle.Turtle()
# Set the turtle's shape
t.shape(shape)
# Set the turtle's size
t.pensize(size)
# Draw the ornament
for i in range(num_shapes):
t.forward(size)
t.left(360 / num_shapes + offset)
# Hide the turtle
t.hideturtle()
# Show the ornament
turtle.done()
```
Here is an example of how to use the code:
```
What shape do you want to create an ornament with? (circle, square, triangle): circle
What size do you want the shape to be? 10
How many shapes do you want to create an ornament with? 5
What is the offset of the shapes? 10
```
This will create an ornament with 5 circles, each with a radius of 10 pixels. The circles will be offset from each other by 10 pixels.
You can change the values of the variables to create different ornaments. For example, you could use a different shape, a different size, or a different number of shapes. You could also change the offset to create a different pattern.