摘要: from turtle import* def square(size=50,rgb='orange'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800,600) speed(0) n=10 for 阅读全文
posted @ 2022-06-10 15:38 王景如 阅读(316) 评论(1) 推荐(0) 编辑
摘要: 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 13:29 王景如 阅读(15) 评论(1) 推荐(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-24 16:28 王景如 阅读(17) 评论(1) 推荐(0) 编辑
摘要: with open('data3.txt','r+',encoding='utf-8')as f: a=[] for i in f: i=i.strip('\n') a.append(i) a.pop(0) b=[eval(i) for i in a] print(f'原始数据:\n{b}') c= 阅读全文
posted @ 2022-05-16 21:25 王景如 阅读(17) 评论(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) def func1(a, b, c, d, e, f): return [a,b,c 阅读全文
posted @ 2022-05-10 22:32 王景如 阅读(22) 评论(2) 推荐(0) 编辑
摘要: import random print('用列表存储随机整数: ') ls = [random.randint(1,100)for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) for i in 阅读全文
posted @ 2022-04-25 11:44 王景如 阅读(22) 评论(3) 推荐(0) 编辑
摘要: 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整数输出3 阅读全文
posted @ 2022-04-12 12:46 王景如 阅读(21) 评论(2) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-03-27 22:55 王景如 阅读(30) 评论(3) 推荐(0) 编辑