我想创建一个数组并调用值。我坚持@开始:(
我的表(静态)
Level | RPM 20 30 40 50 60 70 80 90 100 110 120 130
------------------------------------------------------
6 | 15 31 52 75 105 135 166 202 231 275 289
7 | 16 35 58 85 118 152 185 226 260 305 332
8 | 18 39 65 96 131 169 208 249 289 333 375
例如:@ Level 6和RPM> 60< 70 = 135 @ Level 7和RPM> 50< 60 = 118 更大的想法是,我可以在值之间插值,所以当我例如@ 65 RPM具有正确的值时?
阵列是正确的选择吗?如何构建这个数组? 我没有找到这方面的例子。
这是正确的方法吗?
{
{
"Level6": "RPM20",
"Watt": 15,
}
{
"Level6": "RPM30",
"Watt": 31,
}
}
但是这样我打字就像地狱一样!?
这更有趣:
[
{
"Level X RPM": 6,
"20": 15,
"30": 31,
"40": 52,
"50": 69,
"60": 89,
"70": 106,
"80": 125,
"90": 143
},
{
"Level X RPM": 7,
"20": 16,
"30": 35,
"40": 52,
"50": 70,
"60": 88,
"70": 107,
"80": 124,
"90": 142
},
{
"Level X RPM": 8,
"20": 18,
"30": 39,
"40": 65,
"50": 87,
"60": 111,
"70": 135,
"80": 158,
"90": 180
}
]
答案 0 :(得分:0)
我已经改变了,我的List现在是Python:
LEVEL_TO_POWER = {
1: [6,12,20,29,40,53,69,79,92,106,121],
2: [8,16,26,38,53,68,88,103,120,138,152],
3: [9,20,32,47,66,84,107,125,148,172,186],
4: [11,23,39,56,79,101,126,150,173,206,219],
5: [13,27,45,65,92,117,145,175,202,238,254],
6: [15,31,52,75,105,135,166,202,231,275,289],
7: [16,35,58,85,118,152,185,226,260,305,332],
8: [18,39,65,96,131,169,208,249,289,333,375],
9: [19,42,71,104,144,184,227,272,318,361,408],
10:[21,46,77,113,157,199,245,295,345,386,442],
11:[23,50,84,123,170,216,262,318,372,413,480],
12:[24,53,89,131,183,230,279,342,398,441,512],
13:[26,56,94,139,196,245,296,365,424,468,548],
14:[28,60,101,148,209,261,318,389,449,494,585],
15:[30,64,108,158,222,277,337,415,476,518,620],
16:[32,68,115,168,235,296,355,439,503,548,658],
17:[33,72,122,177,248,312,373,463,530,576,694],
18:[35,76,129,187,261,328,390,484,556,606,727],
19:[37,79,134,195,274,342,407,507,572,632,763],
20:[39,83,140,204,287,354,424,528,598,659,790],
21:[40,87,146,213,300,368,442,551,616,689,812],
22:[42,91,153,223,313,385,461,574,645,720,840],
23:[44,95,160,234,326,401,479,598,673,752,872],
24:[47,101,171,246,340,418,501,625,706,788,908],
}