如何使用两个sperate函数创建2dimentional列表? [英] How do I create a 2dimentional list with two sperate functions?

查看:197
本文介绍了如何使用两个sperate函数创建2dimentional列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何编写一个包含3行和3列的二维列表。然后编写一个嵌套循环,从用户那里获取列表中每个元素的整数。然后编写2个单独的函数来处理表格:



主要创建2d列表并用值填充它

add_rows-接收列表从主要产生每行的总和/总额

add_col-从主要收到列表并产生每个colunm的总和/总额



我的尝试:



................... .................................................. ......

解决方案

参见 5。数据结构 - Python 3.3.6文档 [ ^ ]。

i want to know how to write a two dimensional list with 3 rows and 3 columns. then write a nested loop that gets an integer from the user for each element in the list. then write 2 seperate functions to process the table:

main-creates the 2d list and fills it with values
add_rows-receives the list from the main and produces the sum/total of each row
add_col- recieves the list from the main and produces the sum/total of each colunm

What I have tried:

...........................................................................

解决方案

See 5. Data Structures - Python 3.3.6 documentation[^].


这篇关于如何使用两个sperate函数创建2dimentional列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆