摘要: 1 1 from turtle import * 2 3 def square(size=50, rgb='orange'): 4 pencolor(rgb) 5 for i in range(4): 6 fd(size) 7 left(90) 8 9 def main(): 10 setup(80 阅读全文
posted @ 2022-06-13 22:20 张满月的衣橱 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 class User: 2 count = 0 3 4 def __init__(m, name = 'guest', password = '111111', zt = '1'): 5 User.count += 1 6 m.name = name 7 m.password = passwor 阅读全文
posted @ 2022-06-05 00:05 张满月的衣橱 阅读(8) 评论(1) 推荐(0) 编辑
摘要: 1.实验任务1:CSV格式文件读写 task1_1.py 1 title = ['城市', '人口(万)'] 2 info = [ ['南京', '850'], 3 ['纽约', '2300'], 4 ['东京', '3800'], 5 ['巴黎', '1000'] ] 6 with open('c 阅读全文
posted @ 2022-05-22 15:53 张满月的衣橱 阅读(14) 评论(1) 推荐(0) 编辑
摘要: 1.实验任务1 task1_1.py 1 with open('data1_1.txt','r',encoding='utf-8')as f: 2 data=f.readlines() 3 4 n=0 5 for line in data: 6 if line.strip('\n')=='': 7 阅读全文
posted @ 2022-05-17 13:04 张满月的衣橱 阅读(11) 评论(2) 推荐(0) 编辑
摘要: 1 print(sum) 2 sum = 42 3 print(sum) 4 def inc(n): 5 sum = n+1 6 print(sum) 7 return sum 8 sum = inc(7) + inc(7) 9 print(sum) 2.实验任务2 task2_1.py def f 阅读全文
posted @ 2022-05-10 00:08 张满月的衣橱 阅读(7) 评论(1) 推荐(0) 编辑
摘要: 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.randint(1 阅读全文
posted @ 2022-04-25 23:34 张满月的衣橱 阅读(8) 评论(1) 推荐(0) 编辑
摘要: 1.实验任务1 1 x=list(range(10)) 2 print('整数输出1:',end='') 3 for i in x: 4 print(i,end='') 5 print('\n整数输出2:',end='') 6 for i in x: 7 print(f'{i:02d}',end=' 阅读全文
posted @ 2022-04-12 17:32 张满月的衣橱 阅读(10) 评论(3) 推荐(0) 编辑
摘要: 恢复内容开始 四.实验结论 1.实验任务1 task1_1.py 1 print('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 阅读全文
posted @ 2022-03-27 23:52 张满月的衣橱 阅读(27) 评论(4) 推荐(0) 编辑