We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b5365d commit 8216f14Copy full SHA for 8216f14
0x06-python-classes/103-magic_class.py
@@ -0,0 +1,27 @@
1
+#!/usr/bin/python3
2
+"""Define a MagicClass matching exactly a bytecode provided by Holberton."""
3
+
4
+import math
5
6
7
+class MagicClass:
8
+ """Represent a circle."""
9
10
+ def __init__(self, radius=0):
11
+ """Initialize a MagicClass.
12
13
+ Arg:
14
+ radius (float or int): The radius of the new MagicClass.
15
+ """
16
+ self.__radius = 0
17
+ if type(radius) is not int and type(radius) is not float:
18
+ raise TypeError("radius must be a number")
19
+ self.__radius = radius
20
21
+ def area(self):
22
+ """Return the area of the MagicClass."""
23
+ return (self.__radius ** 2 * math.pi)
24
25
+ def circumference(self):
26
+ """Return The circumference of the MagicClass."""
27
+ return (2 * math.pi * self.__radius)
0 commit comments