Uebung 05

This commit is contained in:
niklas committed 2023-11-29 19:28:40 +01:00
1 parent 9ec5cbf084
commit 4c00a2c0b1
5 files changed
+215

No files matched your search

+20
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()