Uebung 05

This commit is contained in:
2023-11-29 19:28:40 +01:00
parent 9ec5cbf084
commit 4c00a2c0b1
5 changed files with 215 additions and 0 deletions

View File

@ -0,0 +1,20 @@
class Ball:
__diameter__ = 0.0
## Methods
# Constructor
def __init__(self, diameter = 1.0):
self.__diameter__ = diameter
pass
# a simple method
def introduction(self):
print(f"My diameter is {self.__diameter__:.3f}.")
pass
# main code
a = Ball()
b = Ball(2.0)
a.introduction()
b.introduction()