摘要: 实验任务1 task1.py 实验源码: class Account: '''一个模拟银行账户的简单类''' def __init__(self, name, account_number, initial_amount = 10): '''构造新账户''' self._name = name se 阅读全文
posted @ 2023-06-08 14:28 yyzhzbkby 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 task1_.py 实验源码: 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/ 阅读全文
posted @ 2023-06-06 23:14 yyzhzbkby 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 实验任务6 task6.py 实验源码: 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] = 阅读全文
posted @ 2023-06-03 21:20 yyzhzbkby 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 task1.py 实验源码: print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 运行测试截图: 答:不是同一个对象的名称。 阅读全文
posted @ 2023-05-20 16:19 yyzhzbkby 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 task1.py 实验源码: import random print('用列表存储随机整数: ') lst = [random.randint(0, 100) for i in range(5)] print(lst) print('\n用集合存储随机整数: ') s1 = {rando 阅读全文
posted @ 2023-04-22 14:43 yyzhzbkby 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 task.py 实验源码: 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-25 13:22 yyzhzbkby 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 实验任务1: task1_1 实验源码: #task1_1 print的使用 print('hey,u')#输出单个字符串或者单个变量 print('hey', 'u') x,y,z = 1,2,3 print(x,y,z)#输出多个数据项,用“,”隔开 print('x = %d , y = %d 阅读全文
posted @ 2023-03-11 18:11 yyzhzbkby 阅读(24) 评论(0) 推荐(0) 编辑