2022年6月15日
摘要: from turtle import * def square(size=50, rgb='orange'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) le 阅读全文
posted @ 2022-06-15 12:19 橡皮小飒 阅读(37) 评论(0) 推荐(0) 编辑
  2022年6月9日
摘要: class User: count = 0 def __init__(self, name='guest', password=111111, status=1): User.count += 1 self.name = name self.password = password self.stat 阅读全文
posted @ 2022-06-09 10:31 橡皮小飒 阅读(21) 评论(0) 推荐(0) 编辑
  2022年5月29日
摘要: task1-1 task1-2 task1-3 task2-1 task2-2 task2-3 task2-4 task3 def is_valid(m): if len(m)==18 and m.isdigit(): return '合法' elif len(m)==18 and m[-1]==' 阅读全文
posted @ 2022-05-29 15:30 橡皮小飒 阅读(20) 评论(0) 推荐(0) 编辑
  2022年5月15日
摘要: task1 with open('data1_1.txt', 'r', encoding = 'utf-8') as f: data=f.readlines() n=0 for line in data: if line.strip('\n')=='': continue n +=1 print(f 阅读全文
posted @ 2022-05-15 22:40 橡皮小飒 阅读(9) 评论(0) 推荐(0) 编辑
  2022年5月10日
摘要: print(sum) sum = 42 print(sum) def inc(n): sum = n + 1 print(sum) return sum sum = inc(7) + inc(7) print(sum) question:task1.py源码中,共有4处有python语句print( 阅读全文
posted @ 2022-05-10 23:04 橡皮小飒 阅读(8) 评论(0) 推荐(0) 编辑
  2022年4月25日
摘要: 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 ran 阅读全文
posted @ 2022-04-25 22:05 橡皮小飒 阅读(10) 评论(2) 推荐(0) 编辑
  2022年4月12日
摘要: 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 15:55 橡皮小飒 阅读(10) 评论(1) 推荐(0) 编辑
  2022年3月28日
摘要: task1.1 1print('hey, u') 2 print('hey', ' u') 3 x,y,z = 1,2,3 4 print(x, y, z) 5 print('x = %d, y = %d, z = %d' %(x,y,z)) 6 print('x = {}, y = {}, z = 阅读全文
posted @ 2022-03-28 16:45 橡皮小飒 阅读(13) 评论(1) 推荐(0) 编辑