Loading...
    • 개발자 가이드
    • API 레퍼런스
    • MCP
    • 리소스
    • 릴리스 노트
    Search...
    ⌘K
    리소스
    개요용어집시스템 프롬프트
    프롬프트 라이브러리Cosmic Keystrokes기업 예측가웹사이트 마법사Excel 수식 전문가Google Apps 스크립터Python 버그 버스터시간 여행 컨설턴트스토리텔링 도우미출처 인용하기SQL 마법사꿈 해석가말장난 전문가요리 창작가합성어 시인유머러스한 도우미 HalLaTeX 달인감정 색채화Git 달인직유법 달인윤리적 딜레마 안내자회의록 작성자관용구 해설가코드 컨설턴트함수 제작자신조어 창작가CSV 변환기이모지 인코더문장 다듬기관점 탐구가퀴즈 생성기마음챙김 멘토초등학생 눈높이 설명VR 피트니스 혁신가개인정보 정제기메모 달인커리어 코치채점 전문가잰말놀이면접 질문 제작자문법 요정수수께끼 풀기코드 해설가외계인 인류학자데이터 정리자브랜드 빌더효율성 추정기리뷰 분류기방향 해독기동기부여 뮤즈이메일 추출기마스터 모더레이터수업 계획자소크라테스식 현자두운법 연금술사미래형 패션 어드바이저다국어 초능력제품 네이밍 전문가철학적 사색스프레드시트 마법사SF 시나리오 시뮬레이터적응형 편집기바벨의 방송트윗 톤 감지기공항 코드 분석가
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    프롬프트 라이브러리

    Python 버그 버스터

    Python 코드에서 버그를 감지하고 수정합니다.

    이 프롬프트를 개발자 Console에 복사하여 직접 사용해 보세요!

    내용
    System제공된 Python 코드 스니펫을 분석하고, 존재하는 버그나 오류를 식별하며, 이러한 문제를 해결하는 수정된 버전의 코드를 제공하는 것이 당신의 작업입니다. 원본 코드에서 발견한 문제점과 수정 사항이 이를 어떻게 해결하는지 설명하세요. 수정된 코드는 기능적이고, 효율적이며, Python 프로그래밍의 모범 사례를 준수해야 합니다.
    Userdef calculate_average(nums):
    sum = 0
    for num in nums:
    sum += num
    average = sum / len(nums)
    return average

    numbers = [10, 20, 30, 40, 50]
    result = calculate_average(numbers)
    print("The average is:", results)

    예시 출력

    수정된 Python 코드:

    Python
    def calculate_average(nums):
        total = 0
        for num in nums:
            total += num
        average = total / len(nums)
        return average
    
    numbers = [10, 20, 30, 40, 50]
    result = calculate_average(numbers)
    print("The average is:", result)

    설명:

    1. Python 내장 함수 "sum()"의 사용을 피하기 위해 변수 이름 "sum"을 "total"로 변경했습니다.
    2. print 문의 오타를 수정하여 변수를 올바르게 참조하도록 "results"를 "result"로 변경했습니다.

    API 요청

    Was this page helpful?

    • API 요청