摘要: 实验3 from turtle import * # 绘制正方形 # 参数size指定边长,rgb指定画笔颜色 # 如果没有给参数,采用默认值 def square(size=50, rgb = 'blue'): pencolor(rgb) for i in range(4): fd(size) l 阅读全文
posted @ 2021-06-11 17:07 AOIL 阅读(48) 评论(2) 推荐(0) 编辑
摘要: 1.实验任务1: class Account: '''一个模拟银行账户的简单类''' def __init__(self, name, account_number, initial_amount): self._name = name self._card_no = account_number 阅读全文
posted @ 2021-05-25 17:24 AOIL 阅读(41) 评论(1) 推荐(0) 编辑
摘要: 6.实验任务6 with open('data6_1.txt','r',encoding = 'utf-8') as f: c = f.read().split('\n') cc = [str(n).split('\t') for n in c] cc.sort(key = lambda x: x[ 阅读全文
posted @ 2021-05-16 21:51 AOIL 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 1.实验任务1 x=list(range(10)) print('整数输出1:',end='') for i in x: print(i,end=' ') print('\n整数输出2:',end='') for i in x: print(f'{i:02d}',end='-') print('\n 阅读全文
posted @ 2021-04-23 12:34 AOIL 阅读(71) 评论(2) 推荐(0) 编辑
摘要: 1. 实验任务1 x1,y1=1.2,3.57 x2,y2=2.26,8.7 print('{:-^40}'.format('输出1')) print('x1={},y1={}'.format(x1,y1)) print('x2={},y2={}'.format(x2,y2)) print('{:- 阅读全文
posted @ 2021-04-09 01:11 AOIL 阅读(81) 评论(2) 推荐(0) 编辑
摘要: 1.实验任务1 ''' 用法1 ''' print('hey, u') ''' 用法2 ''' print('hey', ' u') x = 1 y = 2 z = 3 print(x, y, z) ''' 用法3 ''' print('x = %d, y = %d, z = %d' %(x,y,z 阅读全文
posted @ 2021-04-02 16:11 AOIL 阅读(107) 评论(0) 推荐(0) 编辑