摘要: 实验1 task1.py 实验源码: class Account: '''一个模拟银行账户的简单类''' def __init__(self, name, account_number, initial_amount = 10): '''构造新账户''' self._name = name self 阅读全文
posted @ 2023-06-11 18:43 刘权兴 阅读(15) 评论(0) 推荐(0)
摘要: task1-1.py 实验源码: from turtle import * def move(x, y): penup() goto(x, y) pendown() def draw(n, size = 100): for i in range(n): fd(size) left(360/n) de 阅读全文
posted @ 2023-06-11 18:29 刘权兴 阅读(44) 评论(0) 推荐(0)
摘要: 实验任务6 task6.py 实验源码: with open('data6.csv','r',encoding='gbk') as f: data = f.readlines() data1=[str(eval(data[i])) for i in range(1,len(data))] data2 阅读全文
posted @ 2023-06-06 15:52 刘权兴 阅读(17) 评论(0) 推荐(0)
摘要: 实验4 函数与异常处理编程 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) 实验结果: 答: line 阅读全文
posted @ 2023-05-23 10:40 刘权兴 阅读(29) 评论(0) 推荐(0)
摘要: 1.实验任务1 task1.py 实验源码: import random print('用列表存储随机整数: ') lst = [random.randint(0, 100) for i in range(5)] print(lst) print('\n用集合存储随机整数: ') s1 = {ran 阅读全文
posted @ 2023-04-19 11:21 刘权兴 阅读(38) 评论(0) 推荐(0)
摘要: 实验任务1 task1.py 实验源码: x = 'nba FIFA' print(x.upper()) print(x.lower()) print(x.swapcase()) print() x = 'abc' print(x.center(10,'*')) print (x.ljust(10, 阅读全文
posted @ 2023-03-22 11:27 刘权兴 阅读(14) 评论(0) 推荐(0)
摘要: 实验任务1 task1-1.py 实验源码: 1 print('hey,u') 2 3 print('hey','u') 4 x,y,z = 1,2,3 5 print(x,y,z) 6 7 print('x = %d,y = %d,z = %d'%(x,y,z)) 8 print('x = {}, 阅读全文
posted @ 2023-03-14 19:33 刘权兴 阅读(44) 评论(0) 推荐(0)