728x90
from random import *
lotto = range(1, 30)
lotto = list(lotto)
shuffle(lotto)
result = sample(lotto, 6)
print(result)
shuffle과 sample 함수는 random 모듈을 통해 사용 가능합니다.
shuffle은 원소를 랜덤하게 섞습니다.
sample은 랜덤하게 n개의 원소를 뽑습니다.
from random import *
lotto = range(1, 30)
lotto = list(lotto)
shuffle(lotto)
result = sample(lotto, 6)
print(result)
shuffle과 sample 함수는 random 모듈을 통해 사용 가능합니다.
shuffle은 원소를 랜덤하게 섞습니다.
sample은 랜덤하게 n개의 원소를 뽑습니다.