From b7806d880746f068e5599db2d8d4b6fa1228e562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radom=C3=ADr=20Ryb=C3=A1k?= Date: Fri, 28 Nov 2025 10:56:31 +0100 Subject: [PATCH] first-commit --- .idea/.gitignore | 3 + .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 +++ .idea/prg2.iml | 10 +++ .idea/vcs.xml | 6 ++ cv12.py | 66 +++++++++++++++++++ cv2.py | 0 8 files changed, 106 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/prg2.iml create mode 100644 .idea/vcs.xml create mode 100644 cv12.py create mode 100644 cv2.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ad60ca4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..417a750 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/prg2.iml b/.idea/prg2.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/prg2.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/cv12.py b/cv12.py new file mode 100644 index 0000000..75a97b6 --- /dev/null +++ b/cv12.py @@ -0,0 +1,66 @@ +import sys +from datetime import datetime +import os +import math +from termcolor import colored, cprint + +while True: + now = datetime.now() + menu = ("1) výpočet věku \n" + "2) rozdíl mezi roky\n" + "3) počet dní od data\n" + "4) konec\n") + print(colored(menu,color="light_green")) + print(colored(now.date(),color="blue")) + volba = input("Vyberte jednu možností: ") + datum_format = "%d.%m.%Y" + if volba == "1": + datum_narozeni = input("Zadejte datum narozeni " + "ve formátu dd.mm.yyyy: ") + try: + date = datetime.strptime(datum_narozeni,datum_format) + vek = now - date + print(f"Váš věk je: {math.floor(vek.days/365.25)}") + input("Pro pokračovní stiskněte Enter...") + except ValueError: + print("Byla zadáno neplatné datum.") + + pass + elif volba == "2": + prvni_datum = input(colored("Zadejte první datum: ",color="red")) + druhe_datum = input("Zadejte druhé datum: ") + try: + prvni_datum = datetime.strptime(prvni_datum,datum_format) + druhe_datum = datetime.strptime(druhe_datum,datum_format) + + if prvni_datum < druhe_datum: + rozdil = druhe_datum-prvni_datum + else: + rozdil = prvni_datum-druhe_datum + print(colored(f"Rozdíl mezi daty je {math.floor(rozdil.days)} dní.",color="yellow")) + input("Pro pokračovní stiskněte Enter...") + except ValueError: + print(colored("Bylo zadáno neplatné datum!",color="red")) + pass + elif volba == "3": + datum = input("Zadejte druhé datum: ") + try: + datum = datetime.strptime(datum, datum_format) + rozdil = now - datum + print(f"Rozdíl datumů je {rozdil.days} dní.\n Rozdíl v letech: {math.floor(rozdil.days/365.25)}") + input("Pro pokračování stistkně Enter...") + except ValueError: + print(colored("Bylo zadáno neplatné datum!", color="red")) + pass + elif volba == "4": + input("Opravdu chcete skončit?") + break + pass + else: + print(colored("Neplatná volba!",color="red")) + + + + + + diff --git a/cv2.py b/cv2.py new file mode 100644 index 0000000..e69de29