摘要: class User(): name='guest' password='111111' def __init__(self,name,password): self.name=name self.password=password self.status=1 def info(self): if 阅读全文
posted @ 2022-06-08 11:11 MeiKoY 阅读(26) 评论(3) 推荐(0) 编辑
摘要: def is_valid(x): if len(x[1])==18 and (x[1][:-1].isdigit() and x[1][-1] in '0123456789X'): return True return Falsewith open('data3_id.txt','r',encodi 阅读全文
posted @ 2022-05-25 12:43 MeiKoY 阅读(23) 评论(1) 推荐(0) 编辑
摘要: task3: with open('data3.txt','r+', encoding='UTF-8') as f: x = [line.strip('\n') for line in f] x.pop(0) x_print = [eval(i) for i in x] print(f"原始数据:\ 阅读全文
posted @ 2022-05-17 19:14 MeiKoY 阅读(20) 评论(2) 推荐(0) 编辑
摘要: task1: print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) 回答问题:这四处的sum不是一个变量名。 第一个是系统内置函数的‘sum’,作用于数的 阅读全文
posted @ 2022-05-11 18:49 MeiKoY 阅读(36) 评论(3) 推荐(0) 编辑
摘要: task1.py 1 import random 2 print('用列表存储随机整数: ') 3 ls = [random.randint(1, 100) for i in range(5)] 4 print(ls) 5 print('\n用集合存储随机整数: ') 6 s1 = {random. 阅读全文
posted @ 2022-04-26 18:31 MeiKoY 阅读(18) 评论(2) 推荐(0) 编辑
摘要: tasky1.py 1 # 基础操作练习: 列表及列表推导式、格式化、类型转换 2 x = list(range(10)) 3 print('整数输出1: ', end = '') 4 for i in x: 5 print(i, end=' ') 6 print('\n整数输出2: ', end 阅读全文
posted @ 2022-04-12 20:43 MeiKoY 阅读(11) 评论(2) 推荐(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-29 16:09 MeiKoY 阅读(45) 评论(2) 推荐(0) 编辑