摘要: 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-13 23:33 东楼贺朝 阅读(17) 评论(0) 推荐(0) 编辑
摘要: class User: def __init__(self,name='guest',password='1'*6,status=1): self.name=name self.password=password self.status=status def info(self): if self. 阅读全文
posted @ 2022-06-07 18:02 东楼贺朝 阅读(17) 评论(0) 推荐(0) 编辑
摘要: def is_valid(y): if len(y)==18: y1=y[:17] if y1.isdigit(): for j in y: y2=[] y2.append(j) m=['1','2','3','4','5','6','7','8','9','X'] if y[-1] in m: r 阅读全文
posted @ 2022-05-24 14:41 东楼贺朝 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #tesk3.py with open('data3.txt','r+', encoding='UTF-8') as f: Z=[] Y=[] x=[] for i in f: x.append(i.strip('\n')) newx=x[1:11] for i in newx: y=float(i 阅读全文
posted @ 2022-05-16 21:44 东楼贺朝 阅读(8) 评论(1) 推荐(0) 编辑
摘要: print(sum) sum = 42 print(sum) def inc(n): sum = n + 1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是 第一次:Build-in 第二次:Global 第三次:Local 第四次 阅读全文
posted @ 2022-05-10 00:33 东楼贺朝 阅读(30) 评论(2) 推荐(0) 编辑
摘要: task1 import randomprint('用列表存储随机整数: ')ls = [random.randint(1, 100) for i in range(5)]print(ls)print('\n用集合存储随机整数: ')s1 = {random.randint(1,100) for i 阅读全文
posted @ 2022-04-25 21:23 东楼贺朝 阅读(11) 评论(3) 推荐(0) 编辑
摘要: task1.py 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 = '-' 阅读全文
posted @ 2022-04-12 19:58 东楼贺朝 阅读(30) 评论(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)) 阅读全文
posted @ 2022-03-28 21:21 东楼贺朝 阅读(11) 评论(3) 推荐(0) 编辑