博客园 - 金子航uuid:24b78886-0ed1-41c2-8670-e3f31dcf42c4;id=753362022-06-13T14:57:09Z金子航https://www.cnblogs.com/0908hh/feed.cnblogs.comhttps://www.cnblogs.com/0908hh/p/16372665.html实验8 - 金子航from turtle import * def square(size=50, rgb='pink'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left2022-06-13T14:57:00Z2022-06-13T14:57:00Z金子航https://www.cnblogs.com/0908hh/【摘要】from turtle import * def square(size=50, rgb='pink'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left <a href="https://www.cnblogs.com/0908hh/p/16372665.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16352375.html实验7 - 金子航class User: num=0 def __init__(self,name='guest',password='111111',status='1'): User.num+=1 self.name=name self.password=password if status=='1': self2022-06-07T08:28:00Z2022-06-07T08:28:00Z金子航https://www.cnblogs.com/0908hh/【摘要】class User: num=0 def __init__(self,name='guest',password='111111',status='1'): User.num+=1 self.name=name self.password=password if status=='1': self <a href="https://www.cnblogs.com/0908hh/p/16352375.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16304584.html实验6 - 金子航实验任务3: task3.py 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:2022-05-24T02:30:00Z2022-05-24T02:30:00Z金子航https://www.cnblogs.com/0908hh/【摘要】实验任务3: task3.py 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: <a href="https://www.cnblogs.com/0908hh/p/16304584.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16273489.html实验5 - 金子航实验任务3: with open('data3.txt','r',encoding='utf-8') as f : with open('data3_processed.txt', 'w', encoding='utf-8') as f1: data=f.read().strip().split('2022-05-15T08:13:00Z2022-05-15T08:13:00Z金子航https://www.cnblogs.com/0908hh/【摘要】实验任务3: with open('data3.txt','r',encoding='utf-8') as f : with open('data3_processed.txt', 'w', encoding='utf-8') as f1: data=f.read().strip().split(' <a href="https://www.cnblogs.com/0908hh/p/16273489.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16245654.html实验4 - 金子航一.实验任务1: task1.py print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 第一个:sum函数未创建,在内建函数作用域中只能2022-05-08T07:03:00Z2022-05-08T07:03:00Z金子航https://www.cnblogs.com/0908hh/【摘要】一.实验任务1: task1.py print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 第一个:sum函数未创建,在内建函数作用域中只能 <a href="https://www.cnblogs.com/0908hh/p/16245654.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16191956.html实验3 - 金子航一.实验任务1: 问题1:范围是1到100闭区间,可以去取到100. 问题2:第一个范围是0到4闭区间,不能取到五,第二个范围1到4闭区间,不能取到五 问题3:不一定,random函数可能取重复值 二.实验任务2: datas = {'2049777001': ['篮球', '羽毛球', '美食',2022-04-25T12:35:00Z2022-04-25T12:35:00Z金子航https://www.cnblogs.com/0908hh/【摘要】一.实验任务1: 问题1:范围是1到100闭区间,可以去取到100. 问题2:第一个范围是0到4闭区间,不能取到五,第二个范围1到4闭区间,不能取到五 问题3:不一定,random函数可能取重复值 二.实验任务2: datas = {'2049777001': ['篮球', '羽毛球', '美食', <a href="https://www.cnblogs.com/0908hh/p/16191956.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16126726.html实验2 - 金子航实验任务1 x = list(range(10)) print('整数输出1: ', end = '') for i in x: print(f'{i:02d}', end = '-') print('\n整数输出3: ', end = '') for i in x[:-1]: print(f'{i2022-04-10T09:26:00Z2022-04-10T09:26:00Z金子航https://www.cnblogs.com/0908hh/【摘要】实验任务1 x = list(range(10)) print('整数输出1: ', end = '') for i in x: print(f'{i:02d}', end = '-') print('\n整数输出3: ', end = '') for i in x[:-1]: print(f'{i <a href="https://www.cnblogs.com/0908hh/p/16126726.html" target="_blank">阅读全文</a>https://www.cnblogs.com/0908hh/p/16045611.html实验任务一 - 金子航# print输出的几种用法#用法1:用于输出单个字符串或单个变量print('hey, u')#用法2:用于输出多个数据项,用逗号分隔print('hey','u')x,y,z=1,2,3print(x, y, z)#用法3:用户混合字符串和变量值print('x=%d, y=%d, z=%d'%2022-03-23T09:16:00Z2022-03-23T09:16:00Z金子航https://www.cnblogs.com/0908hh/【摘要】# print输出的几种用法#用法1:用于输出单个字符串或单个变量print('hey, u')#用法2:用于输出多个数据项,用逗号分隔print('hey','u')x,y,z=1,2,3print(x, y, z)#用法3:用户混合字符串和变量值print('x=%d, y=%d, z=%d'% <a href="https://www.cnblogs.com/0908hh/p/16045611.html" target="_blank">阅读全文</a>