摘要: 1、实验任务1 task1,py 实验源码: 1 class Account: 2 '''一个模拟银行账户的简单类''' 3 def __init__(self, name, account_number, initial_amount = 10): 4 '''构造新账户''' 5 self._na 阅读全文
posted @ 2023-06-06 16:43 desire666666 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1、实验任务1 task1_1.py 实验源码: 1 from turtle import * 2 3 def move(x,y): 4 penup() 5 goto(x,y) 6 pendown() 7 8 def draw(n,size = 100): 9 for i in range(n): 阅读全文
posted @ 2023-06-05 22:14 desire666666 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 6.实验任务6 task6.py 实验源码: 1 with open('data6.csv', 'r', encoding='gbk') as f: 2 old_data = f.read().split('\n') 3 del old_data[0] 4 processed_data = [] 5 阅读全文
posted @ 2023-06-05 20:09 desire666666 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1.实验任务1 task_1.py 实验源码: 1 print(sum) 2 sum = 42 3 print(sum) 4 def inc(n): 5 sum = n+1 6 print(sum) 7 return sum 8 sum = inc(7) + inc(7) 9 print(sum) 阅读全文
posted @ 2023-05-17 11:37 desire666666 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1.实验任务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 = 阅读全文
posted @ 2023-04-20 22:36 desire666666 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 1.实验任务1 实验源码 task_1: #字符串的基础操作 x = 'nba FIFA' print(x.upper()) #字符串转大写 print(x.lower()) #字符串转小写 print(x.swapcase()) #字符串大小写翻转 print() x = 'abc' print( 阅读全文
posted @ 2023-03-22 20:51 desire666666 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 “关于print” task1_1:实验源码: #task1_1 print的使用 print('hey,u')#输出单个字符串或者单个变量 print('hey', 'u') x,y,z = 1,2,3 print(x,y,z)#输出多个数据项,用“,”隔开 print('x = %d 阅读全文
posted @ 2023-03-10 12:41 desire666666 阅读(81) 评论(0) 推荐(0) 编辑