摘要:
实验任务3 from turtle import * def square(size=50, rgb=(0.86,0.6,0)): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): f 阅读全文
摘要:
#实验任务三 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 False 阅读全文
摘要:
#实验任务三 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) if 阅读全文
摘要:
#实验任务一 import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
摘要:
#text1x = 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='-') pri 阅读全文