摘要: from turtle import * from random import random def moveto(x, y): penup() goto(x, y) pendown() setup(800, 600) def rect(length, height, rgb=''): color( 阅读全文
posted @ 2022-06-09 16:03 东揚 阅读(20) 评论(4) 推荐(0) 编辑
摘要: class User: def __init__(self, name='guest', password=111111, status=1): self._name = name self._password = password self._status = status def info(se 阅读全文
posted @ 2022-06-06 19:35 东揚 阅读(23) 评论(3) 推荐(0) 编辑
摘要: task3 with open('data3_id.txt', 'r', encoding='utf-8') as f: data = f.readlines() info = [line.rstrip('\n').split(',') for line in data] info.remove(i 阅读全文
posted @ 2022-05-24 21:38 东揚 阅读(16) 评论(3) 推荐(0) 编辑
摘要: task3 with open('data3.txt', 'r+', encoding='utf-8')as f: a = f.read().split('\n') a[0] = '原始数据' + '\t' + '四舍五入后数据' + '\n' for i in range(1, len(a)): 阅读全文
posted @ 2022-05-14 19:48 东揚 阅读(31) 评论(3) 推荐(0) 编辑
摘要: task1 print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是一个变量名 line1 内置 line3 全局作用域 line7 局 阅读全文
posted @ 2022-05-09 22:27 东揚 阅读(26) 评论(2) 推荐(0) 编辑
摘要: task1.py import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,10 阅读全文
posted @ 2022-04-25 22:02 东揚 阅读(17) 评论(3) 推荐(0) 编辑
摘要: 实验任务1 task1 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='- 阅读全文
posted @ 2022-04-06 21:58 东揚 阅读(29) 评论(3) 推荐(0) 编辑
摘要: 实验任务1 task1.1 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 阅读全文
posted @ 2022-03-23 20:26 东揚 阅读(35) 评论(6) 推荐(0) 编辑