-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmy_module.py
More file actions
44 lines (29 loc) · 1.09 KB
/
my_module.py
File metadata and controls
44 lines (29 loc) · 1.09 KB
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
some_variable = "a string"
def a_function():
pass
# eine Reihenfolge von Werten macht ein tuple
a_list = ['a', 'b', 'c']
a_list[1] = 'd'
#print(a_list)
class GeomShape:
"""This is a description of the class"""
num_edge = None
def __init__(self, num_edges, name = "", **kwargs):
"""This is a description of the method"""
print("__init__ from Geom SHape")
#the kwargs is a way to pass keywords arguments without knowing
#how many beforhand, they will be contained in a dict
for arg in kwargs:
print(arg, kwargs[arg])
#We want to make sure the number of edges is not impossible
if num_edges < 3 :
raise ValueError("a GeomShape needs to have more than 3 edges")
else:
if isinstance(num_edges, int):
self.num_edge = num_edges
else:
raise TypeError("Your should input int only")
def area(self):
print("area from Geom SHape")
def perimeter(self):
print("perimeter from Geom SHape")