diff --git a/old/__init__.py b/old/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/old/date.py b/old/date.py new file mode 100644 index 0000000..dfc09d2 --- /dev/null +++ b/old/date.py @@ -0,0 +1,19 @@ +from datetime import datetime + + +def get_input() -> str: + input_value = input('Datum: ') + if input_value == 'x': + exit() + + return input_value + + +if __name__ == '__main__': + while True: + try: + value1 = datetime.strptime(get_input(), '%d.%m.%Y') + value2 = datetime.strptime(get_input(), '%d.%m.%Y') + print(f'Die Differenz aus {value2} und {value2} ist {abs((value1 - value2).days)}') + except Exception as e: + print(f'Ungültige Eingabe! {e}') diff --git a/old/sqrt.py b/old/sqrt.py new file mode 100644 index 0000000..f3ed7d6 --- /dev/null +++ b/old/sqrt.py @@ -0,0 +1,12 @@ +import math + +if __name__ == '__main__': + while True: + try: + input_value = input('Berechne die Quadratwurzel aus: ') + if input_value == 'x': + exit() + value = float(input_value) + print(f'Die Quadratwurzel aus {value} ist {float(math.sqrt(value))}') + except Exception as e: + print(f'Ungültige Eingabe! {e}')