#๐Ÿ”’ turtle

4 messages ยท Page 1 of 1 (latest)

olive flax
#

anyone know whats wrong with my code the site is not accepting it


def draw_equilateral_triangle(side_length):
    perimeter = 3 * side_length
    turtle.title("Equilateral Triangle Drawer")
    turtle.speed()
    turtle.bgcolor("white")
    turtle.color("black")
    turtle.penup()
    turtle.goto(-side_length / 2, -side_length / (2 * 3 ** 0.5))
    turtle.pendown()
    turtle.setheading(-60)
    for _ in range(3):
        turtle.forward(side_length)
        turtle.left(120)
    return perimeter
side_length = int(input("side: "))
perimeter = draw_equilateral_triangle(side_length)

print("perimeter:", perimeter)```

the request : ***Write a program that takes the side length of an equilateral triangle, draws it, and prints the perimeter of the triangle.

Pay attention that the starting point of drawing the triangle is the center of the page and the direction of the triangle is downwards.

Entrance
The input contains an integer.

output
The output contains a triangle and an integer which is the perimeter of the triangle.***
torn ivyBOT
#

@olive flax

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

torn ivyBOT
#

@olive flax

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.