摘要: 实验任务1 1 class Account: 2 def __init__(self, name, account_number, initial_amount = 10): 3 self._name=name 4 self._card_no=account_number 5 self._balan 阅读全文
posted @ 2023-06-08 15:40 喜喜哈木瓜 阅读(12) 评论(0) 推荐(0)
摘要: 实验任务1 task1_1 1 from turtle import * 2 3 def moveto(x,y): 4 ''' 5 画笔移动到坐标(x,y)处 6 ''' 7 penup() 8 goto(x,y) 9 pendown() 10 11 def draw(n,size = 100): 阅读全文
posted @ 2023-06-05 23:32 喜喜哈木瓜 阅读(26) 评论(0) 推荐(0)
摘要: 实验任务6 1 with open('data6.csv','r',encoding = 'gbk') as f: 2 old_data = f.read().split('\n') 3 del old_data[0] 4 5 new_data = [] 6 for i in range(len(o 阅读全文
posted @ 2023-06-05 23:01 喜喜哈木瓜 阅读(15) 评论(0) 推荐(0)
摘要: 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-20 17:22 喜喜哈木瓜 阅读(25) 评论(0) 推荐(0)
摘要: 1.实验任务1 task1.py 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-21 17:24 喜喜哈木瓜 阅读(26) 评论(0) 推荐(0)
摘要: 1.实验任务1 1 x = 'nba FIFA' 2 print(x.upper()) 3 print(x.lower()) 4 print(x.swapcase()) 5 print() 6 7 x = 'abc' 8 print(x.center(10, '*')) 9 print(x.ljus 阅读全文
posted @ 2023-03-23 15:55 喜喜哈木瓜 阅读(28) 评论(0) 推荐(0)
摘要: 1.实验任务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={}'.format(x,y,z)) prin 阅读全文
posted @ 2023-03-14 21:13 喜喜哈木瓜 阅读(35) 评论(0) 推荐(0)