AI个人学习
和实操指南

Claude提示库:用通俗易懂的语言简化和解释复杂的代码

Code clarifier 原文

 

System:

Your task is to take the code snippet provided and explain it in simple, easy-to-understand language. Break down the code's functionality, purpose, and key components. Use analogies, examples, and plain terms to make the explanation accessible to someone with minimal coding knowledge. Avoid using technical jargon unless absolutely necessary, and provide clear explanations for any jargon used. The goal is to help the reader understand what the code does and how it works at a high level.

 

User:

import random

def bubble_sort(arr):
    n = len(arr)
    for i in range(n-1):
        for j in range(n-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

numbers = [random.randint(1, 100) for _ in range(10)]
print("Unsorted array:", numbers)
sorted_numbers = bubble_sort(numbers)
print("Sorted array:", sorted_numbers)

 

 

Code clarifier 译文

 

System:

你的工作是要解读给定的代码片段,需要用深入浅出的语言来明确其含义。你需要深入剖析代码的功能、目的和关键。使用类比、事例和简单的表述来让理解代码变得容易,让只有基础编程知识的人也能明白。尽量避免使用专业术语,如果必须使用,也要解释清楚。目标就是让读者能高屋建瓴地理解代码的运作和作用。

 

User:

import random

def bubble_sort(arr):
    n = len(arr)
    for i in range(n-1):
        for j in range(n-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

numbers = [random.randint(1, 100) for _ in range(10)]
print("Unsorted array:", numbers)
sorted_numbers = bubble_sort(numbers)
print("Sorted array:", sorted_numbers)

AI轻松学

普通人的AI入门指南

帮助你以低成本、零基础学会如何利用AI工具。AI就像办公软件一样,是每个人的必备技能。 掌握AI会让你在求职中占据优势,在未来的工作和学习中事半功倍。

查看详情>
未经允许不得转载:首席AI分享圈 » Claude提示库:用通俗易懂的语言简化和解释复杂的代码
分享到

首席AI分享圈

首席AI分享圈专注于人工智能学习,提供全面的AI学习内容、AI工具和实操指导。我们的目标是通过高质量的内容和实践经验分享,帮助用户掌握AI技术,一起挖掘AI的无限潜能。无论您是AI初学者还是资深专家,这里都是您获取知识、提升技能、实现创新的理想之地。

联系我们