Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 1] guessing game/hadaci hra cislo/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 1] guessing game/hadaci hra cislo/.idea/hadaci hra cislo.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions 1] guessing game/hadaci hra cislo/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 1] guessing game/hadaci hra cislo/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 1] guessing game/hadaci hra cislo/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions 1] guessing game/hadaci hra cislo/Hadaci hra cislo.py
Original file line number Diff line number Diff line change
@@ -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()
41 changes: 41 additions & 0 deletions 2] loto/hra lotto.py
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 8 additions & 0 deletions 3] guessing game 2/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 3] guessing game 2/.idea/3] guessing game 2.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions 3] guessing game 2/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 3] guessing game 2/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 3] guessing game 2/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.