摘要: task3 from turtle import * def square(size=50, rgb='yellow'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800, 600) speed(0) 阅读全文
posted @ 2022-06-07 22:04 云处安 阅读(34) 评论(3) 推荐(0) 编辑
摘要: class User(): count = 0 def __init__(self, username='guest', password='111111', status='1'): self.username = username self.password = password self.st 阅读全文
posted @ 2022-06-01 19:00 云处安 阅读(26) 评论(2) 推荐(0) 编辑
摘要: with open('data3_id.txt', 'r', encoding='utf-8') as f: file = f.readlines() file.pop(0) id_name = [(i[:2], i[3:].strip('\n')) for i in file] def is_va 阅读全文
posted @ 2022-05-18 19:33 云处安 阅读(25) 评论(2) 推荐(0) 编辑
摘要: #task.3with open('data3.txt', 'r+', encoding = 'utf-8') as f,open('data3_processed.txt', 'r+', encoding = 'utf-8') as ff: num=[line.strip('\n') for li 阅读全文
posted @ 2022-05-14 17:03 云处安 阅读(22) 评论(2) 推荐(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:赋值名 line 阅读全文
posted @ 2022-05-07 13:10 云处安 阅读(32) 评论(3) 推荐(0) 编辑
摘要: #Task1import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
posted @ 2022-04-20 20:27 云处安 阅读(12) 评论(3) 推荐(0) 编辑
摘要: task1.pyx = 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:13 云处安 阅读(36) 评论(3) 推荐(0) 编辑
摘要: #TASK1.1 1 print('hey, u') 2 print('hey', ' u') 3 x,y,z = 1,2,3 4 print(x, y, z) 5 print('x = %d, y = %d, z = %d' %(x,y,z)) 6 print('x = {}, y = {}, z 阅读全文
posted @ 2022-03-23 20:06 云处安 阅读(27) 评论(2) 推荐(0) 编辑