Command & Development/Python

[Python] Lotto 번호 생성

Richard.Ryu 2023. 3. 29. 15:05
반응형
import random
def randomsix() :
    number = random.randint(1, 45)
    return number

lotto_num = []
count  = 0
while True :
    
    if count > 5 :
        break
    random_number = randomsix()
    if random_number not in lotto_num:
        lotto_num.append(random_number)
        count = count + 1
        lotto_num.sort()
print(lotto_num)

 

반응형

'Command & Development > Python' 카테고리의 다른 글

[Python] instagram 자동 좋아요  (0) 2024.08.20
[Python] 가위바위보 게임  (0) 2024.01.08
Python - 4  (0) 2022.05.12
Python - 3  (0) 2022.05.11
Python - 2  (0) 2022.05.10