摘要: from turtle import * def square(size=50, rgb = 'orange'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800, 600) speed(0) for 阅读全文
posted @ 2021-06-18 15:03 你是年少一梦 阅读(21) 评论(0) 推荐(0) 编辑
摘要: class StudentDoc: def __init__(self,number,name,major,score): self.number=number self.name=name self.major=major self.score=score def info(self): prin 阅读全文
posted @ 2021-06-01 12:45 你是年少一梦 阅读(11) 评论(0) 推荐(0) 编辑
摘要: with open('data1_1.txt', 'r', encoding = 'utf-8') as f: n = 0 for line in f: if line.strip('\n') == '': continue n += 1print(f'共{n}行') with open('data 阅读全文
posted @ 2021-05-18 11:00 你是年少一梦 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 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('\输出整数3:',end='') 阅读全文
posted @ 2021-04-22 23:46 你是年少一梦 阅读(69) 评论(0) 推荐(0) 编辑
摘要: x1,y1=1.2,3.57 x2,y2=2.26,8.7 print('{:-^40}'.format('输出1')) print('x1={},y1={}'.format(x1,x2)) print('x2={},y2={}'.format(x2,y2)) print('{:-^40}'.for 阅读全文
posted @ 2021-04-09 00:34 你是年少一梦 阅读(31) 评论(0) 推荐(0) 编辑
摘要: from math import pi text = ''' 好奇心是人的天性。 理想情况下,学习新东西是让人愉快的事。 但学校里的学习似乎有点像苦役。 有时候,需要画一个大饼,每次吃点学点新鲜的,才会每天变得更好一点点。 ''' print(text) r = float(input('给学习画一 阅读全文
posted @ 2021-04-02 19:35 你是年少一梦 阅读(35) 评论(0) 推荐(0) 编辑
摘要: from math import sqrt n=float(input('输入一个数:')) x=sqrt(n) print('%f的平方根是:%.2f'%(n,x)) print('{}的平方根是{}'.format(n,x)) print(f'{n}的平方根是:{x}') 阅读全文
posted @ 2021-04-02 19:33 你是年少一梦 阅读(36) 评论(0) 推荐(0) 编辑
摘要: print(chr(10000),end='') print(chr(0x025b),end='') print(chr(0x2708),end='') print(chr(0x00A5),end='') print(chr(0x266b)) 阅读全文
posted @ 2021-04-02 19:32 你是年少一梦 阅读(35) 评论(0) 推荐(0) 编辑
摘要: x,y=eval(input('Enter two numbers:')) print(f'x={x},y={y}') x,y=y,x print(f'x={x},y={y}') 阅读全文
posted @ 2021-04-02 19:30 你是年少一梦 阅读(24) 评论(0) 推荐(0) 编辑
摘要: from math import pi text = ''' 好奇心是人的天性。 理想情况下,学习新东西是让人愉快的事。 但学校里的学习似乎有点像苦役。 有时候,需要画一个大饼,每次吃点学点新鲜的,才会每天变得更好一点点。 ''' print(text) r = float(input('给学习画一 阅读全文
posted @ 2021-04-02 19:29 你是年少一梦 阅读(52) 评论(0) 推荐(0) 编辑