摘要: 实验任务3 from turtle import * def square(size=50, rgb=(0.86,0.6,0)): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): f 阅读全文
posted @ 2022-06-09 11:18 邵佳佳202183360014 阅读(33) 评论(2) 推荐(0) 编辑
摘要: user.py class Users: def __init__(self, name='guest', password='111111', status=1): self.name = name self.password = password self.status = status def 阅读全文
posted @ 2022-06-01 17:56 邵佳佳202183360014 阅读(28) 评论(3) 推荐(0) 编辑
摘要: #实验任务三 def is_valid(id): if len(id) != 18: return False try: for i in id: if i == 'X': continue elif type(eval(i)) == int: continue else: return False 阅读全文
posted @ 2022-05-18 19:41 邵佳佳202183360014 阅读(40) 评论(2) 推荐(0) 编辑
摘要: #实验任务三 with open('data3.txt', 'r', encoding='utf-8') as f: data = f.read().strip() a = data.split('\n') y = a.pop(0) b = [] for i in a: x = eval(i) if 阅读全文
posted @ 2022-05-10 21:29 邵佳佳202183360014 阅读(29) 评论(2) 推荐(0) 编辑
摘要: #实验任务一print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 答:不是。 line1:内置 line3,line11:全局 line7 阅读全文
posted @ 2022-05-04 19:55 邵佳佳202183360014 阅读(13) 评论(2) 推荐(0) 编辑
摘要: #实验任务一 import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
posted @ 2022-04-20 18:37 邵佳佳202183360014 阅读(28) 评论(2) 推荐(0) 编辑
摘要: #text1x = 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='-') pri 阅读全文
posted @ 2022-04-06 19:27 邵佳佳202183360014 阅读(16) 评论(4) 推荐(0) 编辑
摘要: #实验任务一:task1_1print('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 = {}'. 阅读全文
posted @ 2022-03-23 18:37 邵佳佳202183360014 阅读(36) 评论(3) 推荐(0) 编辑