2022年6月14日
摘要: task3 1 from turtle import* 2 3 4 def square(size=50 , rgb='pink'): 5 '''绘制正方形 6 参数size指定边长 7 参数rgb指定画笔颜色 8 如果没有给参数,采用默认值 9 ''' 10 11 pencolor(rgb) 12 阅读全文
posted @ 2022-06-14 10:58 张玮珊 阅读(28) 评论(1) 推荐(0) 编辑
  2022年6月6日
摘要: 1 class User: 2 def __init__(self, name='guest', password=111111, status=1): 3 self._name = name 4 self._password = password 5 self._status = status 6 阅读全文
posted @ 2022-06-06 22:39 张玮珊 阅读(29) 评论(3) 推荐(0) 编辑
  2022年5月19日
摘要: 实验任务1: 1 def is_valid(x): 2 if len(x)==18: 3 if x[-1]=='Y': 4 return False 5 else: 6 return True 7 else: 8 return False 9 10 with open('C:\\Users\\可可子 阅读全文
posted @ 2022-05-19 19:38 张玮珊 阅读(28) 评论(2) 推荐(0) 编辑
  2022年5月16日
摘要: 实验一: 1 with open('data3.txt','r',encoding='utf-8') as f: 2 data=f.readlines() 3 f.close() 4 with open('data3_proxessed.txt','w',encoding='utf-8') as b 阅读全文
posted @ 2022-05-16 23:16 张玮珊 阅读(50) 评论(2) 推荐(0) 编辑
  2022年5月10日
摘要: 实验任务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) 答:不是。 line1:内置 line 阅读全文
posted @ 2022-05-10 18:08 张玮珊 阅读(29) 评论(2) 推荐(0) 编辑
  2022年4月25日
摘要: 实验任务1: 1 import random 2 print('用列表存储随机整数: ') 3 ls = [random.randint(1, 100) for i in range(5)] 4 print(ls) 5 print('\n用集合存储随机整数: ') 6 s1 = {random.ra 阅读全文
posted @ 2022-04-25 22:45 张玮珊 阅读(23) 评论(1) 推荐(0) 编辑
  2022年4月11日
摘要: # 实验任务1 基础操作练习: 列表及列表推导式、格式化、类型转换 1 x=list(range(10)) 2 print('整数输出1:',end='') 3 4 for i in x: 5 print(i,end='') 6 print('\n整数输出2:',end='') 7 8 for i 阅读全文
posted @ 2022-04-11 19:38 张玮珊 阅读(39) 评论(2) 推荐(0) 编辑
  2022年3月25日
摘要: 1 print('hey, u') 2 3 4 print('hey', ' u') 5 x,y,z = 1,2,3 6 print(x, y, z) 7 8 9 print('x = %d, y = %d, z = %d' %(x,y,z)) 10 print('x = {}, y = {}, z 阅读全文
posted @ 2022-03-25 23:19 张玮珊 阅读(37) 评论(3) 推荐(0) 编辑