摘要:
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) 阅读全文
摘要:
class User(): count = 0 def __init__(self, username='guest', password='111111', status='1'): self.username = username self.password = password self.st 阅读全文
摘要:
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 阅读全文
摘要:
#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 阅读全文
摘要:
#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 阅读全文
摘要:
#Task1import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
摘要:
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 = 阅读全文
摘要:
#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 阅读全文