摘要: Task3.py from turtle import * def square(size=50, rgb=(1,0.7,0)): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): f 阅读全文
posted @ 2022-06-09 11:39 Scavengercjw 阅读(20) 评论(2) 推荐(0) 编辑
摘要: class User: def __init__(self, name='guest', password=111111, status=1): self.name = name self.password = password self.status = status def info(self) 阅读全文
posted @ 2022-06-05 19:34 Scavengercjw 阅读(9) 评论(2) 推荐(0) 编辑
摘要: Task 3.py def is_valid(id): if len(id) != 18: return False try: for i in id: if i == 'X': continue elif type(eval(i)) == int: continue else: return Fa 阅读全文
posted @ 2022-05-22 13:05 Scavengercjw 阅读(8) 评论(2) 推荐(0) 编辑
摘要: Task 3.py with open('data3.txt', 'r', encoding='utf-8') as f: data = f.read().strip() a = data.split('\n') y = a.pop(0) b = [] for i in a: x = eval(i) 阅读全文
posted @ 2022-05-15 10:02 Scavengercjw 阅读(25) 评论(2) 推荐(0) 编辑
摘要: task 1.py 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,line11:全局 line7: 阅读全文
posted @ 2022-05-08 15:20 Scavengercjw 阅读(26) 评论(2) 推荐(0) 编辑
摘要: task 1.py import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,1 阅读全文
posted @ 2022-04-24 11:52 Scavengercjw 阅读(14) 评论(2) 推荐(0) 编辑
摘要: task 1.py 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 20:35 Scavengercjw 阅读(21) 评论(2) 推荐(0) 编辑
摘要: 1、实验任务1 task1-1.py 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 = %d, y = %d, z = %d'%(x,y,z)) pr 阅读全文
posted @ 2022-03-23 19:27 Scavengercjw 阅读(49) 评论(4) 推荐(0) 编辑