달력

4

« 2024/4 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

'코딩실력'에 해당되는 글 1

  1. 2023.02.23 로또 번호 생성기 ^^ (feat. chatGPT)
2023. 2. 23. 21:30

로또 번호 생성기 ^^ (feat. chatGPT) Programming/Python2023. 2. 23. 21:30

728x90
반응형

■ 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

please make the code for lotto number using python language in South Korea.
 
 

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

어찌보면 간단하다고 볼수 있지만, 생각도 하지 않고 검색해서 뚝딱하고 나오니 소오름~~~^^;;

간단한 대학 퀴즈나 레폿같은것은 정말 도움이 많이 되겠는걸요.

매일 매일 이것저것 하나씩 만들어보면서 실행해봐야겠습니다.

좋은 하루되세요~^^

728x90
반응형
:
Posted by 패치#노트