diff --git a/1] guessing game/hadaci hra cislo/.idea/.gitignore b/1] guessing game/hadaci hra cislo/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/1] guessing game/hadaci hra cislo/.idea/hadaci hra cislo.iml b/1] guessing game/hadaci hra cislo/.idea/hadaci hra cislo.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/hadaci hra cislo.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/1] guessing game/hadaci hra cislo/.idea/inspectionProfiles/profiles_settings.xml b/1] guessing game/hadaci hra cislo/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/1] guessing game/hadaci hra cislo/.idea/misc.xml b/1] guessing game/hadaci hra cislo/.idea/misc.xml new file mode 100644 index 0000000..a0f56f8 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/1] guessing game/hadaci hra cislo/.idea/modules.xml b/1] guessing game/hadaci hra cislo/.idea/modules.xml new file mode 100644 index 0000000..683d844 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/1] guessing game/hadaci hra cislo/.idea/vcs.xml b/1] guessing game/hadaci hra cislo/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/1] guessing game/hadaci hra cislo/Hadaci hra cislo.py b/1] guessing game/hadaci hra cislo/Hadaci hra cislo.py new file mode 100644 index 0000000..6666461 --- /dev/null +++ b/1] guessing game/hadaci hra cislo/Hadaci hra cislo.py @@ -0,0 +1,24 @@ +import random + +def hra_hadani_cisel(): + vylosovane_cislo = random.randint(1, 100) + + while True: + tip = input("Guess the number: ") + + if not tip.isdigit(): + print("It's not a number!") + continue + + tip = int(tip) + + if tip < vylosovane_cislo: + print("Too small!") + elif tip > vylosovane_cislo: + print("Too big!") + else: + print("You win!") + break + +if __name__ == "__main__": + hra_hadani_cisel() diff --git a/2] loto/hra lotto.py b/2] loto/hra lotto.py new file mode 100644 index 0000000..5b9c93c --- /dev/null +++ b/2] loto/hra lotto.py @@ -0,0 +1,41 @@ +import random +def zadej_cislo(): + while True: + cislo = input("Your number (1-49): ") + + if not cislo.isdigit(): + print("It's not a number!") + continue + + cislo = int(cislo) + + if cislo < 1 or cislo > 49: + print("Number must be in range 1-49.") + continue + + return cislo + +def hra_lotto(): + vybrane_cisla = [] + for _ in range(6): + cislo = zadej_cislo() + while cislo in vybrane_cisla: + print("This number is already chosen. Try another.") + cislo = zadej_cislo() + vybrane_cisla.append(cislo) + + vybrane_cisla.sort() + print(f"Vybraná čísla: {vybrane_cisla}") + + vylosovana_cisla = random.sample(range(1, 50), 6) + vylosovana_cisla.sort() + print(f"Vylosovaná čísla: {vylosovana_cisla}") + + shodna_cisla = set(vybrane_cisla) & set(vylosovana_cisla) + + print(f"Počet shodných čísel: {len(shodna_cisla)}") + print(f"Shodná čísla: {shodna_cisla}") + + +if __name__ == "__main__": + hra_lotto() \ No newline at end of file diff --git a/3] guessing game 2/.idea/.gitignore b/3] guessing game 2/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/3] guessing game 2/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/3] guessing game 2/.idea/3] guessing game 2.iml b/3] guessing game 2/.idea/3] guessing game 2.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/3] guessing game 2/.idea/3] guessing game 2.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/3] guessing game 2/.idea/inspectionProfiles/profiles_settings.xml b/3] guessing game 2/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/3] guessing game 2/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/3] guessing game 2/.idea/misc.xml b/3] guessing game 2/.idea/misc.xml new file mode 100644 index 0000000..dc9ea49 --- /dev/null +++ b/3] guessing game 2/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/3] guessing game 2/.idea/modules.xml b/3] guessing game 2/.idea/modules.xml new file mode 100644 index 0000000..934c3b2 --- /dev/null +++ b/3] guessing game 2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/3] guessing game 2/.idea/vcs.xml b/3] guessing game 2/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/3] guessing game 2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file