Notice
Recent Posts
Recent Comments
Link
아미(아름다운미소)
python 로또 번호를 연속해서 5개 자동 생성 본문
로또 번호를 연속해서 5개 자동 생성하는 파이썬 예제
# -*- coding: utf-8 -*- ''' Created on 2018. 9. 1. @author: 아미 ''' import random for i in range(5): lotto = [0, 0, 0, 0, 0, 0] for x in range(6): num = 0 while(num in lotto): num = random.randint(1, 45) lotto[x] = num print("로또: " + str(sorted(lotto)))[결과 예]
로또: [4, 8, 20, 24, 27, 33]
로또: [2, 19, 26, 39, 40, 43]
로또: [6, 7, 13, 26, 40, 43]
로또: [13, 20, 37, 38, 41, 42]
로또: [4, 9, 11, 15, 17, 37]
'랭귀지 > python' 카테고리의 다른 글
python open 내장함수 (0) | 2018.09.04 |
---|---|
Python 메일 보내기 (SMTP Mail) (0) | 2018.09.03 |
python glob 특정디렉토리의 해당확장자를가진 파일리스트 추출 (0) | 2018.09.01 |
Selenium 을 이용한 Web 테스트 자동화하기(Selenium with Python ) (0) | 2018.08.31 |
Python Exception Print (0) | 2018.08.30 |
Comments