摘要: 实验任务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-07 10:57 y1cheng 阅读(25) 评论(0) 推荐(0)
摘要: 实验5 文件应用编程 实验任务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 = 阅读全文
posted @ 2023-06-06 19:07 y1cheng 阅读(20) 评论(0) 推荐(0)
摘要: 实验任务1 task1_1.py 1 from turtle import * 2 def move(x, y): 3 penup() 4 goto(x, y) 5 pendown() 6 def draw(n, size = 100): 7 8 for i in range(n): 9 fd(si 阅读全文
posted @ 2023-06-05 17:05 y1cheng 阅读(22) 评论(0) 推荐(0)
摘要: 实验任务1: task1.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-23 10:16 y1cheng 阅读(29) 评论(0) 推荐(0)
摘要: task1.py import random print('用列表存储随机整数: ') lst = [random.randint(0, 100) for i in range(5)] print(lst) print('\n用集合存储随机整数: ') s1 = {random.randint(0, 阅读全文
posted @ 2023-04-25 21:21 y1cheng 阅读(26) 评论(0) 推荐(0)
摘要: 实验任务一 task1.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-28 21:27 y1cheng 阅读(29) 评论(0) 推荐(0)
摘要: 实验任务1: task1_1.py 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 = {},z = {}'.for 阅读全文
posted @ 2023-03-14 20:14 y1cheng 阅读(31) 评论(0) 推荐(0)