摘要: # numpy import numpy as np vector = np.array([1,2,3,4,5]) matrix = np.array([[1,2,3], [4,5,6], [7,8,9]]) print(vector) print(matrix) 以上代码分别输出一个1行5列的行向 阅读全文
posted @ 2021-12-12 01:20 苒若 阅读(91) 评论(0) 推荐(0)
摘要: #数据库的创建 """ import pymysql # 打开数据库连接 db = pymysql.connect(host="localhost",user="root",password="root",database="studentsystem") # 使用cursor()方法创建一个游标对 阅读全文
posted @ 2021-12-08 11:20 苒若 阅读(55) 评论(0) 推荐(0)
摘要: from random import random def printIntro(): print("学号:3012") print("这个程序模拟两个选手A和B的兵乓球比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = eva 阅读全文
posted @ 2021-11-14 02:27 苒若 阅读(62) 评论(0) 推荐(0)
摘要: import jieba def takeSecond(elem): return elem[1] def main(): path = "西游记.txt" file = open(path,"r",encoding="utf-8") text=file.read() file.close() wo 阅读全文
posted @ 2021-11-14 02:00 苒若 阅读(46) 评论(0) 推荐(0)
摘要: 1 """7段数码管绘制""" 2 3 import turtle, datetime 4 def drawGap(): # 绘制数码管间隔 5 turtle.penup() 6 turtle.fd(5) 7 8 def drawLine(draw): # 绘制单段数码管 9 drawGap() 1 阅读全文
posted @ 2021-10-24 11:37 苒若 阅读(196) 评论(0) 推荐(0)
摘要: """画一组同心圆""" #利用turtle库画一组同心圆。用户输入最小圆的半径、画笔宽度和颜色 import turtle radius = eval(input()) #接收用户输入的半径并转换成数值 number = eval(input()) #接收用户输入的画笔宽度并转换成数值 cl = 阅读全文
posted @ 2021-09-21 22:43 苒若 阅读(155) 评论(0) 推荐(0)
摘要: """鸡兔同笼""" n = int(input()) l = list() for k in range(n): a = int(input()) if a%2 != 0: min = max = 0 else: j = a/4 i = a%4/2 min = int(i+j) max = int 阅读全文
posted @ 2021-09-21 21:13 苒若 阅读(44) 评论(0) 推荐(0)
摘要: """逢七拍腿游戏""" total = 99 #记录拍腿次数的变量 for number in range(1,100): #创建一个从1到100(不包括100)的循环 if number % 7 == 0: #判断是否为7的倍数 continue #继续下一次循环 else: string = 阅读全文
posted @ 2021-09-19 11:04 苒若 阅读(200) 评论(0) 推荐(0)
摘要: """助力瑛姑③:for循环改进版解题法""" print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n") for number in range(100): if number%3 == 2 and number%5 == 3 and number%7 == 2: # 阅读全文
posted @ 2021-09-19 10:50 苒若 阅读(48) 评论(0) 推荐(0)
摘要: """打印九九乘法表""" for i in range(1,10): #输出9行 for j in range(1,i+1): #输出与行数相等的列 print(str(j) + 'x' + str(i) + '=' + str(i*j) + '\t',end='') print() #换行 学号 阅读全文
posted @ 2021-09-19 10:46 苒若 阅读(39) 评论(0) 推荐(0)