Python Programming: Lesson 64 - More Techniques for Matrices and the eval Function
PLEASE SUBSCRIBE!!!
In the previous lesson (https://youtu.be/y-sqYQGxUaE), we took a look at matrices, which are lists or tuples of lists or tuples containing ints or floats. There are some numeric operations that we're familiar with from linear algebra, which can be implemented via static and class methods in an Arrays class.
To add two matrices together, add their corresponding entries
To subtract two matrices, subtract their corresponding entries
To find the minimum or maximum element in a matrix, make sure that you have a __lt__ magic method in your class. Then, find the minimum in each list or tuple within the matrix, collect it into a list of minimum elements, and then find the minimum within that. Maximum is similar.
The number of entries in a matrix is given by the number of rows times the number of columns.
The transpose of a matrix swaps the rows and columns.
In this video, we also consider eval(x). The eval function accepts a string and returns the value of the expression wrapped inside of the string. So, 5 + eval("2") = 7, and eval("le" + "n([5])") = 1
0:35 Review of exec(x) and Iterators
3:20 Review of Adding, Subtracting, and Maximum/Minimum Element of Matrices
7:43 NEW: Corner Elements, Number of Elements, and Transpose of a Matrix
15:59 NEW: eval(x) accepts a string x and returns the literal value within the string
In the next video, we will talk more about the exec function, iterators, the eval function, and matrices. Lots to review! AND, we get a new topic. What a cool 20 minutes, on top of the cool 20 minutes in this video: https://youtu.be/pD5tWn4VWMw
Thanks for watching, and PLEASE SUBSCRIBE!!!
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Programming: Lesson 64 - More Techniques for Matrices and the eval Function», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.