摘要:
class User: def __init__(self, name, password='111111', status='1'): # 构造新账户 self.name = name self.password = password self.status = status def info(s 阅读全文
摘要:
任务三: 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 阅读全文
摘要:
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 阅读全文
摘要:
实验任务一: 源码: 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, 阅读全文
摘要:
实验任务一: 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 阅读全文
摘要:
实验任务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 阅读全文
摘要:
实验任务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 阅读全文