摘要: from turtle import * def square(size=50,rgb='pink'): pencolor('orange') for i in range(4): fd(size) left(90) def main(): setup(800,600) speed(0) n=5 f 阅读全文
posted @ 2022-06-09 11:38 张杰的 阅读(43) 评论(2) 推荐(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-07 11:37 张杰的 阅读(32) 评论(3) 推荐(0) 编辑
摘要: def is_valid(x): if len(str(x[3:]))!=18: return False elif len(str(x[3:]))==18 and x[3:].isdigit(): return True else: if x[3:-1].isdigit() and x[-1]!= 阅读全文
posted @ 2022-05-23 18:24 张杰的 阅读(36) 评论(3) 推荐(0) 编辑
摘要: with open('data3.txt','r',encoding='utf-8') as f: data=f.readlines() f.close() with open('data3_proxessed.txt','w',encoding='utf-8') as b: a=['四舍五入后数据 阅读全文
posted @ 2022-05-14 16:21 张杰的 阅读(25) 评论(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) 不是 1:内置 2:全局 3:局部 4:全局 list1=[1,9,8,4] print(sorte 阅读全文
posted @ 2022-05-10 13:03 张杰的 阅读(28) 评论(3) 推荐(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 rang 阅读全文
posted @ 2022-04-23 14:39 张杰的 阅读(47) 评论(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:',e 阅读全文
posted @ 2022-04-11 19:06 张杰的 阅读(18) 评论(3) 推荐(0) 编辑
摘要: 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,y,z)) print(f'x={ 阅读全文
posted @ 2022-03-28 19:59 张杰的 阅读(51) 评论(3) 推荐(0) 编辑