-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path103-magic_class.py
executable file
·46 lines (35 loc) · 958 Bytes
/
103-magic_class.py
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
#!/usr/bin/python3
"""103-magic_class module
Raises:
TypeError: radius must be a number
Returns:
The raduis and the circumference
"""
import math
class MagicClass():
"""MagicClass for 103-magic_class.py task
"""
def __init__(self, radius=0):
"""Initialize Variables
Arguments:
radius -- radius of the MagicClass
Raises:
TypeError: radius must be a number
"""
self.__radius = 0
if type(radius) is not int:
if type(radius) is not float:
raise TypeError('radius must be a number')
self.__radius = radius
def area(self):
"""Calculate the area
Returns:
The area
"""
return (self.__radius ** 2) * math.pi
def circumference(self):
"""Calculate the circumference
Returns:
The circumference
"""
return (2 * math.pi) * self.__radius