摘要: task.3 from turtle import* def square(size=50,rgb='orange'): '''绘制rgb正方形 参数size指定边长 参数指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(siz 阅读全文
posted @ 2022-06-13 15:33 星标g 阅读(13) 评论(1) 推荐(0) 编辑
摘要: task5 class User: def __init__(self,name='guest',password=111111,status=1): self.name=name self.password=password self.status=status def info(self): i 阅读全文
posted @ 2022-06-06 20:25 星标g 阅读(13) 评论(1) 推荐(0) 编辑
摘要: task.3.py def is_valid(s): if len(s)!=18: return False elif s.isdigit()==bool(1) or 'X' in s : return bool(1) else: return False with open('D:\\data3_ 阅读全文
posted @ 2022-05-21 20:55 星标g 阅读(18) 评论(3) 推荐(0) 编辑
摘要: task3.py file1=open('D://data3.txt','r',encoding='utf-8') ls1=[] ls=[] ls2=[] d1=file1.readlines() for i in d1[1:]: i=i.strip('\n') ls1.append(i) prin 阅读全文
posted @ 2022-05-16 21:59 星标g 阅读(34) 评论(3) 推荐(0) 编辑
摘要: task1.py print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 这四处使用的标识符sum不是代表一个变量名。line1的sum是指pyth 阅读全文
posted @ 2022-05-09 22:22 星标g 阅读(24) 评论(3) 推荐(0) 编辑
摘要: task1.py import random print('用列表存储随机整数:') ls=[random.randint(1,100) for i in range(5)] print(ls) print('\n用集合存储随机整数:') s1={random.randint(1,100) for 阅读全文
posted @ 2022-04-25 13:29 星标g 阅读(27) 评论(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-10 20:00 星标g 阅读(28) 评论(4) 推荐(0) 编辑
摘要: task1_1.py 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 = {}'.for 阅读全文
posted @ 2022-03-24 20:35 星标g 阅读(47) 评论(4) 推荐(0) 编辑