한 줄 프롬프트

Amazon Q Developer는 사용자의 의도를 이해하고 한 줄의 설명 프롬프트/주석을 기반으로 코드 제안을 제공합니다. 여러분은 Amazon Q Developer에게 생성 및 반환 지시를 내리게 됩니다.


예시 #1

유저 나이 함수

일반적인 프롬프트

 # CREATE a function called get user age
 # ask the user to input their age
 # RETURN the user's age

Python 프롬프트

prompt_eng.py 라는 이름의 파일을 생성하고, 다음의 코드를 작성합니다.

# create a function called get user age
# ask the user to input their age
# return the user's age 
Amazon Q Developer 제안
def get_user_age():
    age = int(input('Enter your age: '))
    return age

예시 #2

유저 나이를 이용하고 생일 축하 메시지를 리턴

일반적인 프롬프트

create a function to get user age and name  and print happy birthday

Python 프롬프트

같은 파일에 다음의 코드를 작성합니다.

# create a function to get user age and name and print happy birthday
Amazon Q Developer 제안
def printHappyBirthday():
    age = getUserAge()
    name = getUserName()
    print(f"Happy birthday {name}! You are {age} years old.")
    return

Last updated