我正在参加CodeBuddy「首席试玩官」内容创作大赛,本文所使用的 CodeBuddy 免费下载链接:腾讯云代码助手 CodeBuddy - AI 时代的智能编程伙伴
腾讯云代码助手(CodeBuddy)是腾讯自研的AI编程提效工具,凭借腾讯混元与 DeepSeek 混合模型,专为开发者打造。CodeBuddy不仅支持200+编程语言、兼容多种主流IDE,是国内首个支持 MCP 的代码助手,还为开发者提供开发智能体 Craft、智能代码补全、单元测试、代码诊断等多项高效功能,帮助开发者在编码过程中节省时间、提升效率。目前腾讯内部 85% 以上的开发者已使用 CodeBuddy,编码时间平均缩短 40% 以上,AI生成代码占比超四成,研发效率提升超 16%。
我的CodeBuddy初体验:傻瓜式安装VS Code/CodeBuddy→Alt+K调出Chat框输入代码要求回车→ 如果不满意则Retry(Alt+R)继续调整要求→ 写代码变成【"发要求"和审核代码】的无限循环直到代码改到满意为止。
一、VS Code安装CodeBuddy非常简单
VS Code官网:https://code.visualstudio.com/Download
如果已经安装VS Code,点上图按钮直接就看到Install CodeBuddy的按钮了,分分钟安装好
二、写代码变成【"发要求"和审核代码】的无限循环直到代码改到满意为止
比如打印初中抛物线曲线、打印乘法口诀表、打印100道20以内的小学加减法算术题并每20个换页……
真的很方便,小白也能完成简单的代码,当然,复杂的项目是需要具备一定基础的,不说写代码了,抄代码(看代码、改代码)的能力得有。借助CodeBuddy,能快速实现一些功能。
Alt+K调出Chat框,输入要求回车
例如:抛物线
源码
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
#报错No module named 'matplotlib'
# To fix the error, run: pip install matplotlib
import numpy as np
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['SimHei'] # Use SimHei font for Chinese characters
matplotlib.rcParams['axes.unicode_minus'] = False # Ensure minus sign displays correctly
#出抛物线了,但一直libpng warning: iCCP: known incorrect sRGB profile# 能出抛物线了,但一直libpng warning: iCCP: known incorrect sRGB profile
# 定义抛物线函数 y = ax^2 + bx + c
def parabola(x, a=1, b=0, c=0):
return a * x**2 + b * x + c
# Get user input for coefficients a, b, and c
a = float(input("Enter coefficient a for the parabola (default is 1): ") or 1)
b = float(input("Enter coefficient b for the parabola (default is 0): ") or 0)
c = float(input("Enter coefficient c for the parabola (default is 0): ") or 0)
# 生成x值
x_values = np.linspace(-20, 20, 400)
# 计算y值,这里使用默认参数a=1, b=0, c=0,即y=x^2
# Calculate y values using the user-provided coefficients
y_values = parabola(x_values, a, b, c)
# 绘制抛物线
plt.figure(figsize=(8, 6))
# Update the plot label to reflect the new equation
plt.plot(x_values, y_values, label=f'y = {a}x^2 + {b}x + {c}')
# 添加标题和轴标签
plt.title('初中抛物线曲线')
plt.xlabel('x')
plt.ylabel('y')
# 添加图例
plt.legend()
# 显示网格
plt.grid(True)
# 显示图像
plt.show()
截图
写要求的时候尽量详细一些,比如下面这个case,给出的代码不完美,你就Retry(Alt+R)继续调整要求
例如:乘法口诀
源码
# -*- coding: utf-8 -*-
for i in range(1, 10):
for j in range(1, i + 1):
print(f"{j}×{i}={i * j}", end="\t")
print()
截图
例如:算术题
源码
# -*- coding: utf-8 -*-
import random
def generate_arithmetic_problems(count=100, max_num=20, problems_per_page=20):
problems = []
for _ in range(count):
a, b = random.randint(1, max_num), random.randint(1, max_num)
op = random.choice(['+', '-'])
if op == '-' and a < b:
a, b = b, a
problems.append(f"{a} {op} {b} = ")
for i in range(0, len(problems), problems_per_page):
page = problems[i:i + problems_per_page]
print("\n".join(page))
if i + problems_per_page < len(problems):
input("Press Enter to continue...")
generate_arithmetic_problems()
截图
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有