Python - 存储数组的索引号,并将该值与整数

时间:2017-06-01 17:58:56

标签: python python-3.x

我正在试图弄清楚如何存储值的索引或两者。步骤进行:

  • 扫描阵列(逐个)
  • 比较每个值大于某个数字
  • 如果更大,请保存索引编号和值
  • 接下来,检查下一个号码,是否大于某个号码?转到下一个
  • 如果数字小于某个数字,则打破
y1 = []                 % Is a 128 length array
flagcheck = 0           %check for when found a number greater than needed
startofindex = []       %Place to save where the 1st number was found
endofindex = []         %Place where end

for g in y1:
    if (y1.count(g) > 0.001):
        startofindex.append(enumerate(y1.count(g))) % I know this won't work but I can't seem to find the best sol'n
        flagcheck = 1;
        while (flagcheck == 1):
            for g in y1:
                if (y1.count(g) <= 0.001):
                    endofindex.append(enumerate(y1.count(g)))
                    break

我想使用index来格式化特定点的图形轴。

0 个答案:

没有答案