'''
Draw a circle
'''
import math
def draw_circle(radius):
# Initialize row and column based on the radius
y = radius
while y >= -radius: # From +radius to -radius (vertical symmetry)
x = -radius
row = "" # Build each row of the circle
while x <= radius: # From -radius to +radius (horizontal symmetry)
# Check if the point (x, y) is close to the circle's edge using the circle equation
if round(math.sqrt(x**2 + y**2)) == radius:
row += "*"
else:
row += " " # Add spaces for points outside the circle
x += 1
print(row) # Print the row for this y-value
y -= 1
# Main program loop
while True:
radius = int(input("Enter the radius of the circle (in characters): "))
if radius <= 0:
print("Please enter a positive radius.")
continue
draw_circle(radius)
another = input("Do you want to draw another circle? (yes/no): ").lower()
if another != 'yes':
break