2022年6月14日

实验8

摘要: from turtle import * def square(size=50, rgb='orange'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) le 阅读全文

posted @ 2022-06-14 11:33 唔a 阅读(16) 评论(0) 推荐(0) 编辑

2022年6月8日

实验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-08 09:51 唔a 阅读(9) 评论(0) 推荐(0) 编辑

2022年5月24日

实验六

摘要: def is_valid(x): ls=[str(i) for i in range(0,10)] ls.append('X') if len(x)<18: return False for a in range(len(x)): if x[a] not in ls: return False br 阅读全文

posted @ 2022-05-24 22:07 唔a 阅读(4) 评论(0) 推荐(0) 编辑

2022年5月16日

实验5

摘要: with open('data3.txt','r',encoding='utf-8')as f: data=f.read().strip().split('\n') data[0]='原始数据'+'\t'+'四舍五入后数据'+'\n' for i in range(1,len(data)): dat 阅读全文

posted @ 2022-05-16 23:06 唔a 阅读(25) 评论(2) 推荐(0) 编辑

2022年5月11日

实验四

摘要: print(sum) sum = 42 print(sum) def inc(n): sum = n + 1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是: 第一个sum作用的是一开始定义的42; 第二个sum作用的是调用的n+1 阅读全文

posted @ 2022-05-11 00:06 唔a 阅读(20) 评论(1) 推荐(0) 编辑

2022年4月26日

实验三

摘要: import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) for i 阅读全文

posted @ 2022-04-26 21:21 唔a 阅读(14) 评论(4) 推荐(0) 编辑

2022年4月11日

实验二 字符串和列表

摘要: 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='-') print('\n整数输出3 阅读全文

posted @ 2022-04-11 21:58 唔a 阅读(33) 评论(1) 推荐(0) 编辑

2022年3月28日

实验1 python开发环境使用和编程初体验

摘要: print('hey, u') print('hey', ' u') x,y,z = 1,2,3 print(x, y, z) print('x = %d, y = %d, z = %d'%(x,y,z)) print('x = {}, y = {}, z = {}'.format(x,y,z)) 阅读全文

posted @ 2022-03-28 22:41 唔a 阅读(62) 评论(3) 推荐(0) 编辑

导航