Added files from schoolwork
This commit is contained in:
parent
84d4057832
commit
e8d65a9cf6
0
old/__init__.py
Normal file
0
old/__init__.py
Normal file
19
old/date.py
Normal file
19
old/date.py
Normal 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
12
old/sqrt.py
Normal 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}')
|
Loading…
Reference in New Issue
Block a user