当前位置:网站首页>Find the sum of simple types of matrices
Find the sum of simple types of matrices
2022-04-23 08:50:00 【Beauty of algorithm and programming】
1. introduction
adopt Python All kinds of functions and logical relationships can easily solve the problem of large amount of calculation compared with yourself .
2. problem describe
Give any m*n Matrix of size , Find the sum .
3. Algorithm description
First, we need to give the size of the variable specification matrix , Enter the specific value of the matrix through the keyboard and store it in a list , Calculate their sum according to the given matrix specification .
4. Conclusion
In this experiment , We need to use for Loop statement , And it's a cycle plus a cycle . In this experiment , Because there are multiple cycles , Pay attention to the indentation of each line of code , Different indents represent different meanings , The results are different .
Code list 1
| m, n = map(int, input().split()) a = [] for i in range(m): s = input() a.append([int(n) for n in s.split()]) for j in range(m): sum = 0 for k in range(n): sum += a[j][k] print(sum) |
Source of contribution : Deep learning and cultural tourism application laboratory (DLETA)
author : Wang Peng
Editor in chief : Ouyang
版权声明
本文为[Beauty of algorithm and programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230826083685.html
边栏推荐
猜你喜欢

共享办公室,提升入驻体验

cadence的工艺角仿真、蒙特卡洛仿真、PSRR

L2-3 romantic silhouette (25 points)

K210 learning notes (II) serial communication between k210 and stm32

Share the office and improve the settled experience

Notes on 30 steps of introduction to Internet of things of yangtao electronics STM32 III. Explanation of new cubeide project and setting

Summary of solid problems

DJ音乐管理软件Pioneer DJ rekordbox

Noyer électronique stm32 Introduction à l'Internet des objets 30 étapes notes I. différences entre la Bibliothèque Hal et la Bibliothèque standard

Please arrange star trek in advance to break through the new playing method of chain tour, and the market heat continues to rise
随机推荐
【58】最后一个单词的长度【LeetCode】
Harbor企业级镜像管理系统实战
2022-04-22 OpenEBS云原生存储
BK3633 规格书
MySQL查询两张表属性值非重复的数据
搜索树判断 (25 分)
Search tree judgment (25 points)
L2-023 图着色问题 (25 分)(图的遍历)
Test your machine learning pipeline
玩转二叉树 (25 分)
Kubernetes如何使用harbor拉去私有镜像
Idea package jar file
Noyer électronique stm32 Introduction à l'Internet des objets 30 étapes notes I. différences entre la Bibliothèque Hal et la Bibliothèque standard
DJ音乐管理软件Pioneer DJ rekordbox
idea配置连接远程数据库MySQL,或者是Navicat连接远程数据库失败问题(已解决)
LLVM之父Chris Lattner:编译器的黄金时代
Yangtao electronic STM32 Internet of things introduction 30 steps notes 1. The difference between Hal library and standard library
关于cin,scanf和getline,getchar,cin.getline的混合使用
Share the office and improve the settled experience
完全二叉搜索树 (30 分)