파이썬 random1 [Python] 파이썬 예제풀이. 랜덤함수(random), 로또번호 추출하기 예제. random() 함수로 로또번호 추출하기 1 부터 45 사이의 정수 중에서 로또번호 6개를 추출하세요. (조건) 1. random() 함수를 호출합니다. 2. 1 ~ 45사이의 정수에서 6개 번호를 추출합니다. (코딩) from random import * print(int(random() * 45) + 1) print(int(random() * 45) + 1) print(int(random() * 45) + 1) print(int(random() * 45) + 1) print(int(random() * 45) + 1) print(int(random() * 45) + 1) (답) 28 7 39 9 36 16 응용하기 randrange() 함수 print(randrange(1, 46)) # 1 ~ .. 2023. 3. 13. 이전 1 다음