You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
446 B
19 lines
446 B
from math import pi as pi
|
|
|
|
|
|
class Kreis_getattr:
|
|
def __init__(self, radius):
|
|
self.radius = radius
|
|
self.operators ={
|
|
'durchmesser': lambda x: self.radius * 2,
|
|
'umfang': lambda x: self.durchmesser * pi,
|
|
'flaeche': lambda x: self.radius**2 *pi
|
|
}
|
|
|
|
def __getattr__(self, name):
|
|
if name not in self.operators:
|
|
raise TypeError(f'unbekannte Operation {name}')
|
|
|
|
return self.operators[name](0)
|
|
|
|
|
|
|