摘要: import torch import torch.nn as nn import torch.nn.functional as F import os from torchvision.transforms.functional import to_tensor, rgb_to_grayscale 阅读全文
posted @ 2025-11-21 00:09 kkkk0515 阅读(0) 评论(0) 推荐(0)
摘要: import random import time def show_title(): """显示游戏标题""" print("=" * 40) print(" 欢迎来到猜数字小游戏 ") print("=" * 40) print("规则:系统会随机生成一个数字,你需要在有限次数内猜中它!") p 阅读全文
posted @ 2025-06-23 14:22 kkkk0515 阅读(38) 评论(0) 推荐(0)
摘要: import random def simulate_game(prob_a, prob_b): """模拟一局比赛,返回胜者(A或B)""" score_a, score_b = 0, 0 while True: # 随机决定得分方,prob_a为A得分概率 if random.random() 阅读全文
posted @ 2025-06-23 13:44 kkkk0515 阅读(29) 评论(0) 推荐(0)
摘要: import jieba from collections import Counter import re 读取《西游记》文本(假设文件名为'西游记.txt') try: with open('西游记.txt', 'r', encoding='utf-8') as f: content = f.r 阅读全文
posted @ 2025-06-23 13:40 kkkk0515 阅读(14) 评论(0) 推荐(0)
摘要: dollar = eval(input("请输入美元金额:")) rmb = int(dollar * 6.) print("对应的人民币金额是:", rmb) while True: choice = input("请选择兑换方向:1. 美元兑换人民币 2. 人民币兑换美元(输入1或2):") i 阅读全文
posted @ 2025-03-17 23:16 kkkk0515 阅读(36) 评论(0) 推荐(0)
摘要: from turtle import * color('red', 'yellow') begin_fill() while True: forward(200) left(170) if abs(pos()) < 1: break end_fill() done() 阅读全文
posted @ 2025-03-09 22:31 kkkk0515 阅读(11) 评论(0) 推荐(0)
摘要: class BigModelReport: def init(self, title, author, date): self.title = title self.author = author self.date = date self.sections = { "Introduction": 阅读全文
posted @ 2025-03-09 22:19 kkkk0515 阅读(23) 评论(0) 推荐(0)
摘要: import turtle pen = turtle.Turtle() pen.speed(3) for _ in range(5): pen.forward(100) pen.right(144) turtle.done 阅读全文
posted @ 2025-02-25 09:38 kkkk0515 阅读(11) 评论(0) 推荐(0)