摘要: task3from turtle import * def square(size=50, rgb='red'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800, 600) speed(0) n = 阅读全文
posted @ 2022-06-13 16:58 周俊西 阅读(2) 评论(0) 推荐(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-07 12:10 周俊西 阅读(4) 评论(0) 推荐(0) 编辑
摘要: task1 f1=open('data3_id.txt','r',encoding='utf-8') list1,list3=[],[] for i in f1.readlines(): list1.append(i.strip().split(',')) def is_valid(x): if l 阅读全文
posted @ 2022-06-01 16:52 周俊西 阅读(4) 评论(0) 推荐(0) 编辑
摘要: task3 1 with open('data3.txt','r+', encoding='UTF-8') as f: 2 x = [line.strip('\n') for line in f] 3 x.pop(0) 4 x_print = [eval(i) for i in x] 5 print 阅读全文
posted @ 2022-05-16 22:23 周俊西 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 任务1 print(sum) sum=42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是, line1、3、11是全局作用域, line7是函数作用域。 任务2 2 阅读全文
posted @ 2022-05-07 19:11 周俊西 阅读(13) 评论(2) 推荐(0) 编辑
摘要: task1 import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
posted @ 2022-04-26 10:49 周俊西 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 1. 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-11 14:11 周俊西 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 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 = {}'.format 阅读全文
posted @ 2022-03-29 12:16 周俊西 阅读(13) 评论(2) 推荐(0) 编辑