博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2023年12月28日

摘要: import pygame import sys import random # 素材参考地址:https://www.aigei.com/s?q=flappy+bird&type=2d class Bird(object): """定义一个鸟类""" def __init__(self): """ 阅读全文

posted @ 2023-12-28 22:07 啊沫 阅读(7) 评论(0) 推荐(0) 编辑

摘要: numpy基本函数的用法ChatGPT-4-TurboNumPy 是 Python 中的一个开源数值计算扩展库,用于数据分析、机器学习、科学计算等领域。它提供了大量的数学函数来操作数组和矩阵。以下是一些最常用的 NumPy 基本函数的简介和用法示例。创建数组 numpy.array - 用于创建数组 阅读全文

posted @ 2023-12-28 21:33 啊沫 阅读(9) 评论(0) 推荐(0) 编辑

摘要: (2)请用requests库的get()函数访问必应主页20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度 import requests for i in range(20): r = requests.get("https://cn.bing.c 阅读全文

posted @ 2023-12-28 20:43 啊沫 阅读(5) 评论(0) 推荐(0) 编辑

摘要: from random import random def printIntro(): print("学号09,题目为模拟羽毛球") def getInputs(): a = eval(input("请输入选手A的能力值(0—1):")) b = eval(input("请输入选手B的能力值(0—1 阅读全文

posted @ 2023-12-28 20:31 啊沫 阅读(7) 评论(0) 推荐(0) 编辑

摘要: import pygame import sys import random # 素材参考地址:https://www.aigei.com/s?q=flappy+bird&type=2d class Bird(object): """定义一个鸟类""" def __init__(self): """ 阅读全文

posted @ 2023-12-28 20:24 啊沫 阅读(5) 评论(0) 推荐(0) 编辑

摘要: import jieba txt=open('聊斋志异.txt',encoding='gb18030',errors = 'ignore') words=jieba.lcut(txt.read()) counts={} for word in words: if len (word)==1: con 阅读全文

posted @ 2023-12-28 20:11 啊沫 阅读(4) 评论(0) 推荐(0) 编辑

2023年11月21日

摘要: import turtle, datetime import time def drawGap(): turtle.penup() turtle.fd(5) def drawLine(draw): drawGap() turtle.pendown() if draw else turtle.penu 阅读全文

posted @ 2023-11-21 18:04 啊沫 阅读(5) 评论(0) 推荐(0) 编辑

2023年10月31日

摘要: #03超市抹零结账 money = eval(input("请输入商品总价:")) print("抹零后应收{}元".format(int(money))) print("3109") #04计算学生成绩的分差和平均分 student1_point = eval(input("请输入学生成绩:")) 阅读全文

posted @ 2023-10-31 23:55 啊沫 阅读(3) 评论(0) 推荐(0) 编辑

摘要: from random import random from time import perf_counter pi = 0 N = 100 start = perf_counter() for k in range(N): pi += 1 / pow(16, k) * (4 / (8 * k + 阅读全文

posted @ 2023-10-31 23:27 啊沫 阅读(4) 评论(0) 推荐(0) 编辑