I want you to make a class that represents a circle.
The circle should have a radius
, a diameter
, and an area
.
It should also have a nice string representation.
For example:
>>> c = Circle(5)
>>> c
Circle(5)
>>> c.radius
5
>>> c.diameter
10
>>> c.area
78.53981633974483
Additionally the radius should default to 1 if no radius
is specified when you
create your circle:
>>> c = Circle()
>>> c.radius
1
>>> c.diameter
2
There are three bonuses for this exercise.
Bonus 1
This is just a preview of the problem statement.
This exercise includes 3 bonuses, 8 hint links, and automated tests.