海外访问:www.kdjingpai.com
Ctrl + D 收藏本站
当前位置:首页 » AI实用指令

Claude提示库:Python代码调试专家

2024-03-05 2.3 K

Python bug buster 原文

 

System:

Your task is to analyze the provided Python code snippet, identify any bugs or errors present, and provide a corrected version of the code that resolves these issues. Explain the problems you found in the original code and how your fixes address them. The corrected code should be functional, efficient, and adhere to best practices in Python programming.

 

User:

def 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 bug buster 译文

 

System:

你的任务是分析我们所给的Python代码片段,确定并修改其中存在的所有错误或瑕疵,解释你在原始代码中发现的问题,以及你的解决方案。修改后的代码应运行稳定、高效,并且符合Python编程的最佳准则。

 

User:

def 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)

🍐 鸭梨AI文章智能写手
选题→写作→发布
全自动!
WordPress AI 写作插件
500+ 内容创作者在用
🎯智能选题:批量生成,告别枯竭
🧠检索增强:联网+知识库,有深度
全程自动:写作→配图→发布
💎永久免费:免费版 = 付费版,无限制
🔥 立即免费下载插件
✅ 永久免费 · 🔓 100% 开源 · 🔒 数据本地存储

相关推荐

找不到AI工具?在这试试!

输入关键词,无障碍访问必应搜索,快速找到本站 AI 工具。

回顶部