由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 求助:麻烦看看关于2个python的题目
相关主题
Variable size multi-dim arrays (C/C++)zz[合集] 请教数值 解二阶偏微分方程
请教关于block-diagonalization的问题need help for a chanllenging sparse matrix computation problem
稀疏矩阵压缩stable diagonalizer for symmetric eigenproblem
Questionresearch被卡住,极度想撞墙
Numerical low-rankness of Hilbert matrixMatlab 算数值积分
怎么用Matlab把一个3x3的矩阵diagonalize?matlab 解矩阵
请教fortranmatlab能管理多大的内存?>1G
Ask help for a simple questionRe: what is time selective channel?
相关话题的讨论汇总
话题: numberlist话题: function话题: list话题: column话题: make
进入Computation版参与讨论
1 (共1页)
k*****6
发帖数: 26
1
有python比较熟练的朋友帮忙看下这两道题吗?万分感激。。
Do both of these problems using at least one loop each and not using any
special pre-existing functions that give you the answer with just one line
of code.
1. Make a function to count the number of times a specified number is
repeated in a list/array. That means that if we have a number list
numberList=[5, 12, 0, 7, 2, 5, 10, 9, 12, 5];
and we use the function call
numRepeats(numberList, 5)
we get the output: 3 --- meaning 5 occurs three times in numberList.
2. Make a function that takes in a multi-dimensional array/list and returns
the "diagonal" --- a list of the elements at the 1st row-and-1st column, 2nd
row-and-2nd column, 3rd row-and-3rd column, etc. That means if we have a
multi-dimensional array:
multiArray = [[3, -4, 12, 5], [5, 2, 11, -5], [2, 2, 0, 5], [-5, -3, 2, 2]
];
and we use the function call
diagonal(multiArray)
we get the output [3, 2, 0, 2] .
1 (共1页)
进入Computation版参与讨论
相关主题
Re: what is time selective channel?Numerical low-rankness of Hilbert matrix
问个coding theory的题目怎么用Matlab把一个3x3的矩阵diagonalize?
Linux fortran segmentation fail.请教fortran
谁能post一个matrix的template for latexAsk help for a simple question
Variable size multi-dim arrays (C/C++)zz[合集] 请教数值 解二阶偏微分方程
请教关于block-diagonalization的问题need help for a chanllenging sparse matrix computation problem
稀疏矩阵压缩stable diagonalizer for symmetric eigenproblem
Questionresearch被卡住,极度想撞墙
相关话题的讨论汇总
话题: numberlist话题: function话题: list话题: column话题: make