로또 번호 생성기 ^^ (feat. chatGPT) Programming/Python2023. 2. 23. 21:30
■ chat GPT 와 함께 놀기
로또 번호 생성기를 파이썬으로 만들어 보았습니다.
우선 아래와 같이 진행을 했구요.
https://openai.com/blog/chatgpt/
ChatGPT: Optimizing Language Models for Dialogue
We’ve trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests. ChatGPT is
openai.com
Sure, here is an example code for generating a set of six random lotto numbers (1-45) in Python:
import random
# Set the number of lotto numbers to generate
num_numbers = 6
# Set the range of possible lotto numbers (1-45)
min_number = 1
max_number = 45
# Generate a list of unique random lotto numbers
lotto_numbers = random.sample(range(min_number, max_number+1), num_numbers)
# Sort the lotto numbers in ascending order
lotto_numbers.sort()
# Print the lotto numbers
print("Today's lotto numbers are:")
for number in lotto_numbers:
print(number, end=' ')
Please note that this code is for educational purposes only and should not be used to generate actual lotto numbers for gambling or other purposes.
친절한 주석과 함께 결과를 리턴해줍니다.
구글 코랩에서 이 코드를 실행해보았습니다.
Today's lotto numbers are:
12 22 23 26 30 34
Today's lotto numbers are:
5 8 11 37 38 42
어찌보면 간단하다고 볼수 있지만, 생각도 하지 않고 검색해서 뚝딱하고 나오니 소오름~~~^^;;
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/017.gif)
간단한 대학 퀴즈나 레폿같은것은 정말 도움이 많이 되겠는걸요.
매일 매일 이것저것 하나씩 만들어보면서 실행해봐야겠습니다.
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/002.gif)
좋은 하루되세요~^^
'Programming > Python' 카테고리의 다른 글
3개이상의 데이터프레임 합치기 merge over 3 dataframes with indicators (0) | 2023.03.03 |
---|---|
일목균형표(Ichimoku Chart) 파이썬 코드(feat. chatGPT) (0) | 2023.02.24 |
키움 API 실시간 데이터 받은 후 체결창 데이터 시각화 해보기 (0) | 2021.09.11 |
파이썬 캘린더 다음달 출력, calendar next month (1) | 2021.09.07 |
판다스 데이터 프레임 각 셀 별 갯수 구하기, pandas cell length in dataframe (0) | 2021.08.20 |