摘要: task1_1.py from turtle import * def moveto(x,y): penup() goto(x,y) pendown()def main(): setup(800,600) speed(0) for radius in range(20,200,20): moveto 阅读全文
posted @ 2021-06-13 12:48 叹之 阅读(66) 评论(1) 推荐(0) 编辑
摘要: '''银行账户数据:持卡人姓名、账号、当前余额操作:提款、取款、打印账户信息'''class Account: '''一个模拟银行账户的简单类''' def __init__(self, name, account_number, initial_amount): # 构造新账户 self.name 阅读全文
posted @ 2021-05-25 21:24 叹之 阅读(51) 评论(1) 推荐(0) 编辑
摘要: #统计文件data1_1.txt的行数(不包括空白行)#data1_1中的空白行都是由\n组成的空白行#task1_1.pywith open('data1_1.txt','r',encoding='utf-8') as f: data=f.readlines()n=0for line in dat 阅读全文
posted @ 2021-05-12 19:24 叹之 阅读(86) 评论(1) 推荐(0) 编辑
摘要: #基础操作练习一:格式控制 列表解析 类型转换x=list(range(10))print('整数输出一:',end='')for i in x: print(i,end='')print('整数输出二:',end='')for i in x: print(f'{i:02d}',end='-')pr 阅读全文
posted @ 2021-04-18 21:22 叹之 阅读(86) 评论(1) 推荐(0) 编辑
摘要: x1, y1 = 1.2, 3.57x2, y2 = 2.26, 8.7print('{:-^40}'.format('输出1'))print('x1 = {}, y1 = {}'.format(x1, y1))print('x2 = {}, y2 = {}'.format(x2, y2))prin 阅读全文
posted @ 2021-04-09 13:12 叹之 阅读(62) 评论(1) 推荐(0) 编辑
摘要: #print输出函数的几种用法#用法1:用于输出单个字符或变量print('hey,you')#用法2;同时输出多个数据项并用逗号分隔print('hey','u')x=1y=2z=3print(x,y,z)#用法3:用于混合字符串和变量值print('x=%d,y=%d,z=%d' %(x,y,z 阅读全文
posted @ 2021-04-02 17:02 叹之 阅读(62) 评论(0) 推荐(0) 编辑