한 줄 주석

Amazon Q 개발자는 사용자의 의도를 이해하고 한 줄 주석을 기반으로 제안을 제공할 수 있습니다.


예시 #1

메시지 출력

일반적인 프롬프트

function to print a message

Python 프롬프트

# function to print a message

VSCode에서 파일을 생성하고 이름을 single_line_comment.py 로 지정하고 위의 코드를 작성합니다.

Amazon Q Developer 제안
  • 메시지 출력

    def print_message(message):
        print(message)
        return

예시 #2

배열 요소 출력

일반적인 프롬프트

function to print each element in the array and return

Python 프롬프트

#function to print each element in the array and return

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

Amazon Q Developer 제안

배열 요소 출력

def print_array(array):
    for element in array:
        print(element)
    return

예시 #3

배열 요소 더하기

일반적인 프롬프트

This function will return the sum of the array

Python 프롬프트

# This function will return the sum of the array

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

Amazon Q Developer 제안
  • 배열 합계 출력

    def sum_array(array):
        sum = 0
        for element in array:
            sum += element
        return sum
    

Last updated