摘要: 实验结论 实验任务1 程序源代码 class Account: '''一个模拟银行账户的简单类''' def __init__(self, name, account_number, initial_amount = 10): '''构造新账户''' self._name = name self._ 阅读全文
posted @ 2023-06-14 00:02 气工朱聪 阅读(17) 评论(0) 推荐(0)
摘要: 实验结论 实验任务1 1-1实验源代码 from turtle import * def move(x, y): penup() goto(x, y) pendown() def draw(n, size = 100): for i in range(n): fd(size) left(360/n) 阅读全文
posted @ 2023-06-08 17:00 气工朱聪 阅读(52) 评论(0) 推荐(0)
摘要: 实验结论 实验任务6 程序源代码 with open('data6.csv','r',encoding='gbk') as f: data1 = f.read().split('\n') del data1[0] for i in range(len(data1)): data1[i] = eval 阅读全文
posted @ 2023-06-06 20:36 气工朱聪 阅读(17) 评论(0) 推荐(0)
摘要: 实验结论 实验任务1 程序源代码 print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 运行测试截图 问题回答:不是同一个对象的名称。li 阅读全文
posted @ 2023-05-23 20:14 气工朱聪 阅读(47) 评论(0) 推荐(0)
摘要: 实验结论 实验1 程序源代码 import random print('用列表存储随机整数: ') lst = [random.randint(0, 100) for i in range(5)] print(lst) print('\n用集合存储随机整数: ') s1 = {random.rand 阅读全文
posted @ 2023-04-25 00:24 气工朱聪 阅读(26) 评论(0) 推荐(0)
摘要: 实验结论 实验任务1 程序源代码 x = 'nba FIFA' print(x.upper()) print(x.lower()) print(x.swapcase()) print() x = 'abc' print(x.center(10, '*')) print(x.ljust(10, '*' 阅读全文
posted @ 2023-03-27 18:01 气工朱聪 阅读(21) 评论(0) 推荐(0)
摘要: 实验结论 实验任务1 1-1程序源代码 #print输出的几种用法 print('hey,u') print('hey','u') x,y,z = 1,2,3 print(x,y,z) print('x = %d,y = %d,z = %d'%(x,y,z)) print('x = {},y = { 阅读全文
posted @ 2023-03-14 10:03 气工朱聪 阅读(37) 评论(0) 推荐(0)