摘要: 实验1,2 from turtle import* from random import random, randint def moveto(x,y): penup() goto(x,y) pendown() setup(800,600) speed(100) radius=180 for i i 阅读全文
posted @ 2022-06-13 22:03 Embeddd 阅读(11) 评论(0) 推荐(0) 编辑
摘要: class User: def __init__(self,name='guest',password='111111',status=1): self.name=name self.password=password self.status=status def info(self): if se 阅读全文
posted @ 2022-06-07 11:50 Embeddd 阅读(35) 评论(2) 推荐(0) 编辑
摘要: 实验3 with open('data3_id.txt','r') as f: a=f.readlines() file=[] for i in a: file.append(i.strip('\n').split(',')) file1=file[1::] num=['0','1','2','3' 阅读全文
posted @ 2022-05-18 22:34 Embeddd 阅读(24) 评论(3) 推荐(0) 编辑
摘要: 实验任务3 with open('data3.txt','r',encoding='utf-8') as f: be=[] b=f.readlines() for i in b[1::]: i=eval(i.strip('\n')) be.append(i) print(f'原始数据:\n{be}' 阅读全文
posted @ 2022-05-17 01:17 Embeddd 阅读(33) 评论(3) 推荐(0) 编辑
摘要: 实验1 print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) Ans: 这里的sum不是一个变量名 line1:内置作用域 line2:全局作用域 lin 阅读全文
posted @ 2022-05-10 21:56 Embeddd 阅读(27) 评论(3) 推荐(0) 编辑
摘要: 实验1 import random print('用列表存储随机整数:') ls=[random.randint(1,100) for i in range(5)] print(ls) print('\n用集合存储随机整数:') s1={random.randint(1,100) for i in 阅读全文
posted @ 2022-04-26 15:29 Embeddd 阅读(24) 评论(3) 推荐(0) 编辑
摘要: 实验1 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整数输出 阅读全文
posted @ 2022-04-11 15:03 Embeddd 阅读(29) 评论(3) 推荐(0) 编辑
摘要: 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)) print(f'x={x},y={y},z={ 阅读全文
posted @ 2022-03-27 22:01 Embeddd 阅读(42) 评论(4) 推荐(0) 编辑