☰ 분류

코드 언어 변환 프롬프트

원본 언어와 대상 언어, 코드를 넣으면 기능을 유지하면서 대상 언어 코드로 변환하고 이해를 돕는 주석을 추가합니다.

분류번역·요약 › 번역
태그번역분석개발자코드
프롬프트 (영어 본문 · 답은 한국어로 옵니다)
Act as a code translator. You are capable of converting code from any programming language to another. Your task is to take the provided code in ${sourceLanguage} and translate it into ${targetLanguage}. Ensure to include comments for clarity and understanding.

You will:
- Analyze the syntax and semantics of the source code.
- Convert the code into the target language while preserving functionality.
- Add comments to explain key parts of the translated code.

Rules:
- Maintain code efficiency and structure.
- Ensure no loss of functionality during translation.

어떤 프롬프트인가

서로 다른 프로그래밍 언어 간 코드 변환 초안을 만들 때 적합하다. 구문과 의미를 분석해 구조와 효율을 유지하라고 하지만 실행 검증은 별도로 요구하지 않는다.

모델 비교

ChatGPT는 정확하고 간결해 가장 우수하다. Gemini도 충실하지만 장황하며, [C]는 답이 없어 평가 요건을 충족하지 못한다.

ChatGPT종합 1위
49/ 50

+ 간결한 코드로 기능과 주석 요구를 충족했다.

- Math.round는 Python round와 완전히 같지 않다.

Gemini
45/ 50

+ JSDoc과 번역 포인트가 대응 관계를 명확히 한다.

- 요청에 비해 부연 설명이 길고 반올림 차이를 놓쳤다.

기준ChatGPTGemini앞선 모델
지시 준수1010동점
정확성99동점
구체성1010동점
구성·가독성109ChatGPT +11%
분량 적정성107ChatGPT +43%

gpt-5.6-sol가 모델 이름을 가린 채 1~10점으로 채점했습니다 (2026-09-24). 측정값이 아니라 AI 심사 결과입니다.

답 전문 보기

같은 입력을 세 모델에 넣어 받은 답을 그대로 옮겼습니다. 각 CLI(에이전트 하네스)에서 실행했습니다. ChatGPT·Claude 앱이나 웹에서는 답이 다를 수 있습니다.

넣은 입력
[붙여 넣은 자료]
sourceLanguage: Python
targetLanguage: JavaScript

아래 파이썬 코드를 번역해줘.

def calculate_shipping_fee(weight_kg, distance_km, is_express=False):
    base_fee = 3000
    weight_fee = weight_kg * 500
    distance_fee = distance_km * 100
    total = base_fee + weight_fee + distance_fee
    if is_express:
        total *= 1.5
    return round(total)

orders = [
    {"id": 1, "weight": 2.5, "distance": 15},
    {"id": 2, "weight": 0.8, "distance": 42, "express": True},
]

for order in orders:
    fee = calculate_shipping_fee(order["weight"], order["distance"], order.get("express", False))
    print(f"주문 {order['id']}: 배송비 {fee}원")
gpt-5.6-luna (codex CLI · 에이전트 하네스) · 실행일 2026-09-24
// 배송비를 계산하는 함수
function calculateShippingFee(weightKg, distanceKm, isExpress = false) {
  const baseFee = 3000;
  const weightFee = weightKg * 500;
  const distanceFee = distanceKm * 100;

  let total = baseFee + weightFee + distanceFee;

  // 특급 배송이면 배송비를 1.5배 적용
  if (isExpress) {
    total *= 1.5;
  }

  // Python의 round()와 유사하게 반올림
  return Math.round(total);
}

const orders = [
  { id: 1, weight: 2.5, distance: 15 },
  { id: 2, weight: 0.8, distance: 42, express: true },
];

// 각 주문의 배송비 출력
for (const order of orders) {
  const fee = calculateShippingFee(
    order.weight,
    order.distance,
    order.express ?? false
  );

  console.log(`주문 ${order.id}: 배송비 ${fee}원`);
}

같은 분류의 프롬프트

성경체 번역가 역할 프롬프트
중영 번역 프롬프트
중영 번역 역할을 맡기는 프롬프트
중영 번역 전문가 역할 프롬프트
영어 페르시아어 압축번역 프롬프트