import json
f = open("pokemon_data.json","r",encoding="utf_8")
dat = json.load(f)
cnt = 0
lst = []
if i in range ["speed"]:
cnt += 1
lst.append(["name"])
print(f"速度大於100的寶可夢有{lst}")
print(lst)
請問要如何才能統計輸出下列json數據中speed大於100的名字。
部分json數據如下
{
"name": "1",
"isMegaEvolution": true,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 97,
"attack": 167,
"defence": 97,
"spAttack": 167,
"spDefence": 97,
"speed": 129
}
},
{
"name": "2",
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 80,
"attack": 95,
"defence": 115,
"spAttack": 130,
"spDefence": 115,
"speed": 65
}
},
{
"name": "3",
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 90,
"attack": 125,
"defence": 80,
"spAttack": 90,
"spDefence": 90,
"speed": 125
}
},
{
"name": "4",
"form": "",
"isMegaEvolution": false,
"evolutions": [804],
"hiddenAbilities": [],
"stats": {
"hp": 67,
"attack": 73,
"defence": 67,
"spAttack": 73,
"spDefence": 67,
"speed": 73
}
},
{
"name": "5",
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 73,
"attack": 73,
"defence": 73,
"spAttack": 127,
"spDefence": 73,
"speed": 121
}
},
{
"no": 6,
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 61,
"attack": 131,
"defence": 211,
"spAttack": 53,
"spDefence": 101,
"speed": 13
}
},
{
"name": "7",
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 53,
"attack": 127,
"defence": 53,
"spAttack": 151,
"spDefence": 79,
"speed": 107
}
},
{
"name": "8",
"form": "",
"isMegaEvolution": false,
"evolutions": [],
"hiddenAbilities": [],
"stats": {
"hp": 88,
"attack": 112,
"defence": 75,
"spAttack": 102,
"spDefence": 80,
"speed": 143
}
}
]