Advertisement
ifigazsi

Lottery v2

Apr 18th, 2024 (edited)
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import random
  2.  
  3. def kiir(adat):
  4.     return ', '.join(str(x) for x in sorted(int(x) for x in adat))
  5.  
  6. print("Üdvözlünk a lottójátékban!")
  7. print("Tippelj 5 számot 1 és 90 között!")
  8. lotto_szamok = [str(x) for x in range(1, 91)]
  9. tippek = set()
  10. while len(tippek) < 5:
  11.     tip = input(f"{len(tippek)+1}. tipp: ")
  12.     if tip in lotto_szamok:
  13.         tippek.add(tip)
  14.  
  15. huzott_szamok = set(random.sample(lotto_szamok, 5))
  16. print(f"Huzott szamok: {kiir(huzott_szamok)}")
  17. print(f"Tippek: {kiir(tippek)}")
  18. if len(huzott_szamok & tippek) > 0:         #van találat?
  19.     print(f"Talalat: {kiir(huzott_szamok & tippek)}")
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement