sunchenxi

导航

2022年6月13日 #

实验8 python库应用编程与体验

摘要: 恢复内容开始 #task3.py from turtle import * def square(size=50, rgb='orange'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in rang 阅读全文

posted @ 2022-06-13 20:46 靠谱一星 阅读(23) 评论(1) 推荐(0) 编辑

2022年6月1日 #

实验7 类和模块

摘要: 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 def inf 阅读全文

posted @ 2022-06-01 17:28 靠谱一星 阅读(27) 评论(1) 推荐(0) 编辑

2022年5月21日 #

实验6 文件应用编程-2

摘要: 1 #task1_1 2 title=['城市', '人口(万)'] 3 info=[['南京', '850'], 4 ['纽约', '2300'], 5 ['东京', '3800'], 6 ['巴黎', '1000']] 7 with open('city.csv','w',encoding='u 阅读全文

posted @ 2022-05-21 20:30 靠谱一星 阅读(24) 评论(0) 推荐(0) 编辑

2022年5月14日 #

实验5 文件应用编程

摘要: 1 #task3.py 2 with open('data3.txt','r',encoding='utf-8') as f : 3 with open('data3_processed.txt', 'w', encoding='utf-8') as f1: 4 data=f.read().stri 阅读全文

posted @ 2022-05-14 16:01 靠谱一星 阅读(16) 评论(1) 推荐(0) 编辑

2022年5月5日 #

实验4 函数与异常处理应用编程

摘要: 1 #task1.py 2 print(sum) 3 sum = 42 4 print(sum) 5 def inc(n): 6 sum = n+1 7 print(sum) 8 return sum 9 sum = inc(7) + inc(7) 10 print(sum) 1.Built-in 阅读全文

posted @ 2022-05-05 11:37 靠谱一星 阅读(21) 评论(3) 推荐(0) 编辑

2022年4月23日 #

实验3 控制语句与组合数据类型应用编程

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

posted @ 2022-04-23 15:02 靠谱一星 阅读(39) 评论(2) 推荐(0) 编辑

2022年4月7日 #

实验2 字符串和列表

摘要: 1 #task1.py 2 x=list(range(10)) 3 print('整数输出1:',end='') 4 for i in x: 5 print(i,end=' ') 6 7 print('\n整数输出2:',end='') 8 for i in x: 9 print(f'{i:02d} 阅读全文

posted @ 2022-04-07 09:43 靠谱一星 阅读(43) 评论(2) 推荐(0) 编辑

2022年3月25日 #

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

摘要: 1 # test1.py 2 print('hey,u') 3 4 print('hey','u') 5 x,y,z=1,2,3 6 print(x,y,z) 7 8 print('x=%d,y=%d,z=%d'%(x,y,z)) 9 print('x={},y={},z={}'.format(x, 阅读全文

posted @ 2022-03-25 14:47 靠谱一星 阅读(51) 评论(1) 推荐(0) 编辑