Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python dictionaries help PokemonPowerpy SubmitRun Grades Reset 1 #In the Pokemon video game series, every Pokemon has six Console output will be displayed here 2#stats:

image text in transcribedpython dictionaries help

PokemonPowerpy SubmitRun Grades Reset 1 #In the Pokemon video game series, every Pokemon has six Console output will be displayed here 2#stats: HP, Attack, Defense, Special Attack, Special Defense, 3 #and Speed 4 # TWrite a function called total_stats that will take as input 6#a list of dictionaries. Each actionary will have seven #key-value 8 7 pairs: # 94- name: a Pokemon's name e # -hp, attack, defense, special attack, special defense, 11 and speed: an integer representing that Pokemon's stat 12in that category 13 # The keys 14+Your function should return single dictionary. 15#of the dicti 16 #original list, and the values should be the total stats should be the Pokemon names from the 17 afor each Pokemon (add HP, Attack, Defense, Special Attack 18 TSpecial Defense, and Speed) 19 29 #For example, if this was one of the dictionaries in the 21 #original list: 22 # 23 #{"nane": "Bulbasaur", 24 #"Special Attack": 65, 25? "HP": 45, "Attack": 49, "Defense": 49, "Special Defense": 65, "Speed : 45) the dictionary you 26 Then one of the key-value pairs in 27 #return would be: "Bulbasaur": 318 (45 + 49 + 49 + 65 + 65 + 28 #45-318) 29 30 #Add your function here! 32 34 35 #Below are some lines of code that will test your function 36#You can change the value of the variable(s) to test your 37#function with different inputs. 38 39 If your function works correctly, this will originally 40 #print (although the order of the keys nay va ): 41 #'Bulbasaur':318, "Charmander". 309, 'Squirtle. :3141 42 sterter"name":"Bulbasaur" "hp": 45, "attack": 49, "defense": 49, "special attack": 65, special defense": 63, "speed": 45), defense": 50 "speed: 65}, defense": 64, " speed" 43) "name": "Charmander", "hp": 39, "attack": 52, "defense" 43, "special attack": 60, "special 43 "name":"Squirtle", "hp": 44, "attack": 48, "defense": 65, "special attack": 50, "special 45 print total stots (starters)) 46 47

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Understand how you can develop your leadership potential.

Answered: 1 week ago