Работа №3.3: Часть 1. Структурированные типы данных и операции файлового ввода/вывода (Python)

Итоговый код программы ----------------------------------------------------------------------- import random M = [] for i in range(0,10): ([]) for j in range(0,20): M[i].append((0,10)) def printMatrix(m): for row in m: print(’|’ ’ ’.join(map(str,row)) ’|’) def frequence(m): w = {} for row in m: for element in row: if element in w: w[element] = 1 else: w[element] = 1 for i in (): w[i] /= 10*20 return w def saveMatrix(m): f = open(’d:/Study/EnergySoft/Python3Portable/matrix/’, ’w’) result = [] for row in m: (’ ’.join(map(str,row))) (’ ’.join(result)) () def readMatrix(filename): f = open(filename, ’r’) result =
Back to Top