2022年6月13日
摘要: from turtle import * def square(size=50, rgb='pink'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left 阅读全文
posted @ 2022-06-13 20:49 Lil不要被人喂啦 阅读(10) 评论(1) 推荐(0) 编辑
  2022年6月7日
摘要: class User: """用户""" count = 0 def __init__(self, name='guest', password=111111, status=1): User.count += 1 self.name = name self.password = password 阅读全文
posted @ 2022-06-07 22:36 Lil不要被人喂啦 阅读(10) 评论(1) 推荐(0) 编辑
  2022年5月24日
摘要: task3 def is_valid(x): if len(x) != 18: return False for i in x: if not (i.isdigit() or i == 'X'): return False else: return True import csv l=[] with 阅读全文
posted @ 2022-05-24 14:55 Lil不要被人喂啦 阅读(24) 评论(1) 推荐(0) 编辑
  2022年5月15日
摘要: 实验三 with open('data3.txt', 'r+', encoding = 'utf-8') as f,open('data3_processed.txt', 'r+', encoding = 'utf-8') as ff: num=[line.strip('\n') for line 阅读全文
posted @ 2022-05-15 21:03 Lil不要被人喂啦 阅读(12) 评论(1) 推荐(0) 编辑
  2022年5月9日
摘要: 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-09 22:15 Lil不要被人喂啦 阅读(11) 评论(3) 推荐(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 阅读全文
posted @ 2022-04-25 21:27 Lil不要被人喂啦 阅读(27) 评论(3) 推荐(0) 编辑
  2022年4月12日
摘要: x=list(range(10)) print('整数输出1:',end='') for i in x: print(f'{i:02d}', end = '-') print('\n整数输出2:',end='') for i in x: print(f'{1:02d}',end='-') print 阅读全文
posted @ 2022-04-12 22:10 Lil不要被人喂啦 阅读(9) 评论(3) 推荐(0) 编辑
  2022年3月28日
摘要: # 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-28 20:03 Lil不要被人喂啦 阅读(45) 评论(3) 推荐(0) 编辑