Advertisement
Nairo05

Untitled

Nov 14th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. #---------------------------------------------------------
  2. #
  3. from random import randint
  4. Lottozahlen = [0,0,0,0,0,0]
  5. #index         0 1 2 3 4 5
  6.  
  7. #6 Random Numbers
  8. def newLottoNumbers():
  9.     for izahl in range(0,len(Lottozahlen)-1):
  10.         prelotto = randint(1,49)
  11.  
  12.         #Auf doppelte überprüfen
  13.         if (prelotto in Lottozahlen):
  14.             print("Doppelte zahl")
  15.             while(True):
  16.                 newzahl = randint(1,49)
  17.                 if (prelotto != newzahl):
  18.                     Lottozahlen[izahl] = newzahl
  19.                     break
  20.                 else:
  21.                     print("Schon wieder selbe Zahl")
  22.                     return
  23.         else:
  24.             Lottozahlen[izahl] = prelotto
  25.            
  26. #Getter and Setter                
  27. def getLotto(accessInt):
  28.     return Lottozahlen[accessInt]
  29.  
  30. def setLottoNumber(accessInt, number):
  31.     Lottozahlen[accessInt]=number
  32.  
  33. def printLotto():
  34.     print(Lottozahlen)
  35. #
  36. #---------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement