Loading...
    • 개발자 가이드
    • API 참조
    • MCP
    • 리소스
    • 릴리스 노트
    Search...
    ⌘K
    리소스
    개요용어집시스템 프롬프트
    프롬프트 라이브러리Cosmic KeystrokesCorporate clairvoyantWebsite wizardExcel formula expertGoogle apps scripterPython bug busterTime travel consultantStorytelling sidekick출처 인용SQL sorcererDream interpreterPun-ditCulinary creatorPortmanteau poetHal the humorous helperLaTeX legendMood colorizerGit gudSimile savantEthical dilemma navigatorMeeting scribeIdiom illuminatorCode consultantFunction fabricatorNeologism creatorCSV converterEmoji encoderProse polisherPerspectives pondererTrivia generatorMindfulness mentorSecond-grade simplifierVR fitness innovatorPII purifierMemo maestroCareer coachGrading guruTongue twisterInterview question crafterGrammar genieRiddle me thisCode clarifierAlien anthropologistData organizerBrand builderEfficiency estimatorReview classifierDirection decoderMotivational museEmail extractorMaster moderatorLesson plannerSocratic sageAlliteration alchemistFuturistic fashion advisorPolyglot superpowersProduct naming proPhilosophical musingsSpreadsheet sorcererSci-fi scenario simulatorAdaptive editorBabel's broadcastsTweet tone detectorAirport code analyst
    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 요청

    • API 요청