praktikum_wissenschaftliche.../uebung_05/exercise_01/exercise_01.py
2023-11-29 19:28:40 +01:00

21 lines
374 B
Python

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