摘要: 实验任务1 task1.py 1 class Account: 2 3 def __init__(self, name, account_number, initial_amount = 10): 4 self._name = name 5 self._card_no = account_numbe 阅读全文
posted @ 2023-06-13 23:21 风过晚月意 阅读(23) 评论(0) 推荐(0)
摘要: 实验任务1 task1_1 from turtle import * def moveto(x,y): ''' 画笔移动到坐标(x,y)处 ''' penup() goto(x,y) pendown() def draw(n,size = 100): ''' 绘制边长为size的正n边形 ''' f 阅读全文
posted @ 2023-06-06 21:07 风过晚月意 阅读(74) 评论(0) 推荐(0)
摘要: 实验任务6 task6 # 读取并处理原始数据with open('data6.csv','r',encoding = 'gbk') as f: old_data = f.read().split('\n') del old_data[0] # 四舍五入得到新数据 new_data = [] for 阅读全文
posted @ 2023-06-06 20:46 风过晚月意 阅读(21) 评论(0) 推荐(0)
摘要: 实验任务1 1 import random 2 3 print('用列表存储随机整数: ') 4 lst = [random.randint(0, 100) for i in range(5)] 5 print(lst) 6 7 print('\n用集合存储随机整数: ') 8 s1 = {rand 阅读全文
posted @ 2023-04-22 16:26 风过晚月意 阅读(42) 评论(0) 推荐(0)
摘要: 1. 实验任务1 task1.py 1 # 字符串的基础操作 2 # 课堂上没有演示的一些方法 3 x = 'nba FIFA' 4 print(x.upper()) # 字符串转大写 5 print(x.lower()) # 字符串转小写 6 print(x.swapcase()) # 字符串大小 阅读全文
posted @ 2023-03-22 11:19 风过晚月意 阅读(33) 评论(0) 推荐(0)
摘要: 实验1 task1-1 实验源码 1 # 实验1 2 3 #用法1 4 print('hey,u') 5 6 #用法2 7 print('hey','u') 8 9 x,y,z = 1,2,3 10 print(x,y,z) 11 12 #用法3 13 print('x = %d, y = %d, 阅读全文
posted @ 2023-03-09 18:05 风过晚月意 阅读(39) 评论(0) 推荐(0)