摘要: 1 task3.py 2 from turtle import * 3 def square(size = 50, rgb = 'orange'): 4 pencolor(rgb) 5 for i in range(4): 6 fd(size) 7 left(90) 8 9 def main(): 阅读全文
posted @ 2021-06-11 17:31 年年有尼 阅读(34) 评论(0) 推荐(0)
摘要: task5.py ''' 学生档案管理 数据(属性):学号、姓名、专业、python课程分数 操作(方法):打印学生信息、返回课程分数、修改课程分数 ''' class StudentDoc: '''学生档案管理''' def __init__(self, student_number, name, 阅读全文
posted @ 2021-05-25 18:15 年年有尼 阅读(22) 评论(1) 推荐(0)
摘要: task6.py import random with open('data7.txt','r') as f: lines = f.readlines() n=eval(input('输入随机抽点的人数:')) b=set() while len(b) < n: r=random.randint(0 阅读全文
posted @ 2021-05-15 16:16 年年有尼 阅读(28) 评论(0) 推荐(0)
摘要: task1_1.py 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}', e 阅读全文
posted @ 2021-04-17 14:34 年年有尼 阅读(15) 评论(0) 推荐(0)
摘要: 1. 实验任务1#task1.py #使用字符串的format()方法,对输出数据进行格式化 x1,y1=1.2, 3.57 x2,y2 = 2.26, 8.7 print("{:-^40}".format("输出1")) print("x1={},y1={}".format(x1,y1)) pri 阅读全文
posted @ 2021-04-03 10:40 年年有尼 阅读(45) 评论(0) 推荐(0)
摘要: 1.实验任务1 # print输出的几种用法 # 用法1:用于输出单个字符串或单个变量print('hey, u') # 用法2: 用于输出多个数据项,用逗号分隔print('hey', ' u')x = 1y = 2z = 3print(x, y, z) # 用法3: 用户混合字符串和变量值pri 阅读全文
posted @ 2021-04-02 18:53 年年有尼 阅读(14) 评论(0) 推荐(0)