摘要: task3.py 1 from turtle import * 2 3 def square(size=50, rgb='pink'): 4 '''绘制正方形 5 参数size指定边长 6 参数rgb指定画笔颜色 7 如果没有给参数,采用默认值 8 ''' 9 pencolor(rgb) 10 fo 阅读全文
posted @ 2022-06-13 15:48 昏汐 阅读(9) 评论(2) 推荐(0) 编辑
摘要: user.py 1 class User: 2 def __init__(self,name,password,status): 3 if name=="" and password=="": 4 self.name="guest" 5 self.password="111111" 6 self.s 阅读全文
posted @ 2022-06-01 17:02 昏汐 阅读(19) 评论(2) 推荐(0) 编辑
摘要: task3.py 1 def is_valid(a): 2 l=0 3 f=0 4 for i in a: 5 l+=1 6 if '0'<=i<='9' or i=='X': 7 pass 8 else: 9 f+=1 10 break 11 if l!=18 or f!=0: 12 return 阅读全文
posted @ 2022-05-19 10:45 昏汐 阅读(21) 评论(3) 推荐(0) 编辑
摘要: task3.py 1 with open("data3.txt","r",encoding="utf-8") as f: 2 d=f.readlines() 3 flag=d 4 with open("data3_processed.txt","a",encoding="utf-8") as f1: 阅读全文
posted @ 2022-05-16 19:05 昏汐 阅读(10) 评论(2) 推荐(0) 编辑
摘要: task1.py 1 print(sum) 2 sum=42 3 print(sum) 4 5 def inc(n): 6 sum=n+1 7 print(sum) 8 return sum 9 10 sum=inc(7)+inc(7) 11 print(sum) 运行测试截图 问题:这四处使用的标 阅读全文
posted @ 2022-05-07 19:16 昏汐 阅读(18) 评论(2) 推荐(0) 编辑
摘要: task1.py 1 import random 2 3 print("用列表存储随机整数:") 4 ls=[random.randint(1,100) for i in range(5)] 5 print(ls) 6 7 print("\n用集合存储随机整数:") 8 s1={random.ran 阅读全文
posted @ 2022-04-22 23:03 昏汐 阅读(21) 评论(2) 推荐(0) 编辑
摘要: task1.py 1 x=list(range(10)) 2 3 print("整数输出1:",end="") 4 for i in x: 5 print(i,end="") 6 7 print("\n整数输出2:",end="") 8 for i in x: 9 print(f"{i:02d}", 阅读全文
posted @ 2022-04-09 13:36 昏汐 阅读(20) 评论(3) 推荐(0) 编辑
摘要: task1_1.py 1 print('hey,u') 2 3 print('hey', 'u') 4 x, y, z = 1, 2, 3 5 print(x, y, z) 6 7 print('x=%d, y=%d, z=%d' %(x,y,z)) 8 print('x={},y={},z={}' 阅读全文
posted @ 2022-03-26 16:30 昏汐 阅读(18) 评论(4) 推荐(0) 编辑