首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看全站
import openai

# 設置OpenAI API的密鑰
openai.api_key = '11'

# 定義聊天模型的輸入提示
def get_chat_response(prompt):
    response = openai.Completion.create(
        engine='text-davinci-003',  # 指定使用的模型
        prompt=prompt,
        max_tokens=50  # 生成聊天回復的最大長度
    )
......................
阅读全部 | 晏晴 贴于 2023年7月20日 22:51     hide bbsi
class Alpaca:
    def __init__(self, name, age):b I’m
        self.name = 你爹
        self.age = 12

    def introduce(self):
        print(f"你好,我叫{self.name} ,現在 {self.age} 歲.")
阅读全部 | 晏晴 贴于 2023年7月20日 22:29     hide bbsi
#include <iostream>
#include <string>

// 函數:回答用戶的問題
std::string respond(const std::string& question) {
    // 在這裡添加你的回答邏輯
    // 你可以使用條件語句、函數等來組織你的邏輯

    // 簡單示例:回答固定的問候語
    if (question == "你好") {
        return "你好,有什麼我可以幫助你的嗎?";
    }
......................
阅读全部 | 晏晴 贴于 2023年7月19日 18:37     hide bbsi
name = input("請輸入您的名字:")
print("您好," + name + "!")

if len(name) > 5:
    print("您的名字很長!")
else:
    print("您的名字很短!")

for i in range(5):
    print("迴圈運行次數:" + str(i+1))
阅读全部 | 晏晴 贴于 2023年7月19日 18:34     hide bbsi
# https://www.luogu.com.cn/problem/P5710

"""

如果你还记得 True 转成 int 参与 + 运算对应自动转化为 1,False 自动转化为 0,下列代码可简单写为


q = 0
if A + B == 2:
    q = 1

w = 0
......................
阅读全部 | sunsongwei 贴于 2023年7月17日 21:35     hide bbsi
# https://www.luogu.com.cn/problem/P5710



x = int(input())

# 条件1 的结果保存到 变量 A 中

A = (x % 2 == 0)

# 条件2 的结果保存到 变量 B 中

......................
阅读全部 | sunsongwei 贴于 2023年7月17日 21:35     hide bbsi
for i in range(2):
    table={0:'0',1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"}
    def DtoH(num):
        if num<=0:
            return ''
        y=num%16
        return DtoH(num//16)+table[y]
    num=int(input('请输入一个十进制的数字:'))
    print(f"十六进制:{DtoH(num)}")
print('代码运行成功\n退出')
阅读全部 | ambulance 贴于 2023年7月17日 10:54     hide bbsi
screen = turtle.Screen()
screen.bgcolor("black")

def create_firework():
    colors = ["red", "orange", "yellow", "green", "blue", "purple", "white"]
    firework = turtle.Turtle()
    firework.shape("circle")
    firework.color(random.choice(colors))
    firework.shapesize(0.5)
    firework.penup()
    firework.speed(0)
    firework.goto(random.randint(-200, 200), -200)
......................
阅读全部 | 文清清 贴于 2023年7月7日 17:07     hide bbsi
with t as (select 'A' 单位, '制造业' 行业门类, '纺织业' 行业大类,'棉纺织及印染精加工' 行业中类, 1 金额
union all 
select 'D' 单位, '制造业' 行业门类, '纺织服装、服饰业' 行业大类,'机织服装制造' 行业中类, 4 金额
union all 
select 'E' 单位, '制造业' 行业门类, '纺织服装、服饰业' 行业大类,'针织或钩针编织服装制造' 行业中类, 4 金额)

select t.单位, 
case t.行业中类 when '机织服装制造' then t.金额 else 0 end 机织服装制造,
case t.行业中类 when '针织或钩针编织服装制造' then t.金额 else 0 end 针织或钩针编织服装制造,
case t.行业中类 when '棉纺织及印染精加工' then t.金额 else 0 end 棉纺织及印染精加工
from t
阅读全部 | yiyanxiyin 贴于 2023年7月6日 18:29     hide bbsi
isWeixin() {  
        var ua = navigator.userAgent.toLowerCase();  
        if(ua.match(/MicroMessenger/i)=="micromessenger") {  
            return true;  
        } else {  
            return false;  
        }  
    },
阅读全部 | yiyanxiyin 贴于 2023年7月4日 12:07     hide bbsi
上一页 4 5 6 7 8 9 10 11 12 13 下一页