摘要: class User: def __init__(self, name, password='111111', status='1'): # 构造新账户 self.name = name self.password = password self.status = status def info(s 阅读全文
posted @ 2022-06-05 23:21 希木子 阅读(20) 评论(2) 推荐(0) 编辑
摘要: 任务三: def is_valid(x): ls=[str(i) for i in range(0,10)] ls.append('X') if len(x)<18: return False for a in range(len(x)): if x[a] not in ls: return Fal 阅读全文
posted @ 2022-05-21 09:37 希木子 阅读(19) 评论(2) 推荐(0) 编辑
摘要: with open('data3.txt', 'r', encoding='utf-8') as f: data = f.read().strip().split('\n') data[0] = '原始数据' + '\t' + '四舍五入后数据' + '\n' for i in range(1, l 阅读全文
posted @ 2022-05-15 16:16 希木子 阅读(25) 评论(3) 推荐(0) 编辑
摘要: 实验任务一: 源码: print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 运行结果: 实验任务二: 源码: def func(a, b, 阅读全文
posted @ 2022-05-10 16:54 希木子 阅读(24) 评论(1) 推荐(0) 编辑
摘要: 实验任务一: import randomprint('用列表存储随机整数:')ls=[random.randint(1,100) for i in range(5)]print(ls) print('\n用集合存储随机整数:')s1={random.randint(1,100) for i in r 阅读全文
posted @ 2022-04-23 22:12 希木子 阅读(17) 评论(3) 推荐(0) 编辑
摘要: 实验任务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 @ 2022-04-11 11:05 希木子 阅读(7) 评论(3) 推荐(0) 编辑
摘要: 实验任务1: 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 阅读全文
posted @ 2022-03-28 20:09 希木子 阅读(53) 评论(4) 推荐(0) 编辑