摘要:
from turtle import * def square(size=50, rgb='pink'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left 阅读全文
摘要:
with open('C://data3_id.txt', 'r', encoding = 'utf-8') as f: datas=f.readlines() datas=[line.strip().split(',') for line in datas] data=[]def isvalid( 阅读全文
摘要:
with open('D://a//data3.txt', 'r', encoding = 'utf-8') as f: data = f.read().split('\n') x=[] for line in data: if data.count(line)==1: x.append(line) 阅读全文
摘要:
实验任务1 import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
摘要:
实验任务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 = ' 阅读全文