import math from datetime import datetime class Program: """ Class to specify the program like as in C# """ def __init__(self): pass @staticmethod def sqrt(input_value: float) -> float: """ Calculates the square root of a value :param input_value: :return: """ return float(math.sqrt(input_value)) @staticmethod def date(date_one: datetime, date_two: datetime): """ Calculates to difference of two dates :param date_one: :param date_two: :return: """ return abs(date_one - date_two).days @staticmethod def get_input(output: str) -> str: """ Gets input and gives a given output Prints given output and gives given input :param output: :return: """ input_value = input(output) if input_value == 'x': exit() return input_value def main(self): """ Start point of Program :return: """ input_value = float(self.get_input('Wurzel aus: ')) print(f'Die Wurzel aus {input_value} ist {self.sqrt(input_value)}') date1 = datetime.strptime(self.get_input('Datum 1: '), '%d.%m.%Y') date2 = datetime.strptime(self.get_input('Datum 2: '), '%d.%m.%Y') print(f'Die Differenz aus {date1} und {date2} ist {self.date(date1, date2)}')