-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcircle.py
More file actions
52 lines (38 loc) · 945 Bytes
/
Copy pathcircle.py
File metadata and controls
52 lines (38 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
"""
Small Python Projects for Beginners
Turtle exampe: Draw a circle
Version: 1.0
Python 3.13
Date created: October 9th, 2024
Date modified: -
"""
import turtle
def draw_circle(x: float, y: float, r: float) -> None:
"""
Draw a circle
Args:
x (float): x-coordinate
y (float): y-coordinate
r (float): radius
"""
window = turtle.Screen()
window.bgcolor("yellow")
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.circle(r)
turtle.hideturtle()
turtle.done
window.mainloop()
def main():
"""
Enter x-, y-coordinates and radius and
invoke draw_circle() function.
"""
x: float = float(input("Enter the center x-coordinate: "))
y: float = float(input("Enter the center y-coordinate: "))
radius: float = float(input("Enter the radius: "))
draw_circle(x, y, radius)
if __name__ == "__main__":
main()