Added files from schoolwork

This commit is contained in:
Sven Heidemann 2020-12-13 01:03:54 +01:00
parent 84d4057832
commit e8d65a9cf6
3 changed files with 31 additions and 0 deletions

0
old/__init__.py Normal file
View File

19
old/date.py Normal file
View File

@ -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}')

12
old/sqrt.py Normal file
View File

@ -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}')