摘要: task3 1 from turtle import * 2 3 def square(size=50, rgb='orange'): 4 '''绘制正方形 5 参数size指定边长 6 参数rgb指定画笔颜色 7 如果没有给参数,采用默认值 8 ''' 9 pencolor(rgb) 10 for 阅读全文
posted @ 2022-06-13 21:56 熊猫小丸子 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1 class User: 2 count = 0 3 4 def __init__(self, name='guest', password=111111, status=1): 5 User.count += 1 6 self.name = name 7 self.password = pass 阅读全文
posted @ 2022-06-05 22:44 熊猫小丸子 阅读(24) 评论(1) 推荐(0) 编辑
摘要: task 3 1 def is_valid(m): 2 if len(m)==18 and m.isdigit(): 3 return '合法' 4 elif len(m)==18 and m[-1]=='X': 5 return '合法' 6 else: 7 return '不合法' 8 9 wi 阅读全文
posted @ 2022-05-21 10:37 熊猫小丸子 阅读(25) 评论(2) 推荐(0) 编辑
摘要: task 3 1 with open ('data3.txt','r',encoding='utf-8') as f: 2 data = f.read() 3 data = data.split('\n') 4 m = ['{:20}'.format(i) if i == '原始数据' else ' 阅读全文
posted @ 2022-05-14 12:15 熊猫小丸子 阅读(34) 评论(2) 推荐(0) 编辑
摘要: task 1 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) question: 阅读全文
posted @ 2022-05-04 22:55 熊猫小丸子 阅读(60) 评论(3) 推荐(0) 编辑
摘要: task 1 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.r 阅读全文
posted @ 2022-04-25 20:33 熊猫小丸子 阅读(34) 评论(1) 推荐(0) 编辑
摘要: task1 1 # task1.py 2 3 x = list(range(10)) 4 5 print('整数输出1: ', end = '') 6 for i in x: 7 print(i,end=' ') 8 9 print('\n整数输出2: ',end = '') 10 for i in 阅读全文
posted @ 2022-04-10 17:40 熊猫小丸子 阅读(19) 评论(2) 推荐(0) 编辑
摘要: # print输出的几种用法 # 用法1:用于输出单个字符串或单个变量 print('hey, u') # 用法2: 用于输出多个数据项,用逗号分隔 print('hey', ' u') x,y,z = 1,2,3 print(x, y, z) # 用法3: 用户混合字符串和变量值 print('x 阅读全文
posted @ 2022-03-24 21:59 熊猫小丸子 阅读(144) 评论(2) 推荐(0) 编辑