program 3

User Generated

Anvsss

Programming

Description

do everything said in the instruction pdf file. also I uploaded everything you might want

Unformatted Attachment Preview

1,Bulbasaur,318,grass,poison 2,Ivysaur,405,grass,poison 3,Venusaur,525,grass,poison 4,Charmander,309,fire 5,Charmeleon,405,fire 6,Charizard,534,fire,flying 7,Squirtle,314,water 8,Wartortle,405,water 9,Blastoise,530,water 10,Caterpie,195,bug 11,Metapod,205,bug 12,Butterfree,395,bug,flying 13,Weedle,195,bug,poison 14,Kakuna,205,bug,poison 15,Beedrill,395,bug,poison 16,Pidgey,251,normal,flying 17,Pidgeotto,349,normal,flying 18,Pidgeot,479,normal,flying 19,Rattata,253,normal 20,Raticate,413,normal 21,Spearow,262,normal,flying 22,Fearow,442,normal,flying 23,Ekans,288,poison 24,Arbok,448,poison 25,Pikachu,320,electric 26,Raichu,485,electric,psychic 27,Sandshrew,300,ground 28,Sandslash,450,ground 29,Nidoran,275,poison 30,Nidorina,365,poison10/16/2017 # # # # # # # # https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/pokedex.py --------------------------------------CSCI 127, Joy and Beauty of Data Program 3: Pokedex Your Name(, Your Partner's Name) Last Modified: --------------------------------------A brief overview of the program. --------------------------------------- # Your solution goes here ... # --------------------------------------# Do not change anything below this line # --------------------------------------def createPokedex(filename): pokedex = {} file = open(filename, "r") for pokemon in file: pokelist = pokemon.strip().split(",") index = int(pokelist.pop(0)) pokedex[index] = [pokelist.pop(0)] pokedex[index] += [int(pokelist.pop(0))] pokedex[index] += [pokelist.pop(0)] if len(pokelist) == 1: pokedex[index] += [pokelist.pop(0)] # name # hit points # type # optional second type file.close() return pokedex # --------------------------------------def getChoice(low, high, message): legal_choice = False while not legal_choice: legal_choice = True answer = input(message) for character in answer: if character not in string.digits: legal_choice = False print("That is not a number, try again.") break if legal_choice: answer = int(answer) if (answer < low) or (answer > high): legal_choice = False print("That is not a valid choice, try again.") return answer # --------------------------------------def main(): pokedex = createPokedex("pokedex.txt") choice = 0 while choice != 6: printMenu() choice = getChoice(1, 6, "Enter a menu option: ") if choice == 1: printPokedex(pokedex) elif choice == 2: name = input("Enter a Pokemon name: ") name = name.capitalize() lookupByName(pokedex, name) https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/pokedex.py 1/2 10/16/2017 https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/pokedex.py elif choice == 3: number = getChoice(1, 1000, "Enter a Pokemon number: ") lookupByNumber(pokedex, number) elif choice == 4: howManyPokemon(pokedex) elif choice == 5: howManyHitPoints(pokedex) print("Thank you. Goodbye!") # --------------------------------------main() https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/pokedex.py 2/2 10/16/2017 CSCI 127, Program 3 Program 3: Pokédex Logistics Due Date: Tuesday, October 17th no later than midnight. Partner Information: You may complete this assignment individually or with exactly one partner. If you work with a partner, you must both be enrolled in the same lab section or you will both lose 10 points. Submission Instructions: Upload your solution, renamed to YourFirstName-YourLastNamePartnerFirstName-PartnerLastName.py to the BrightSpace Program 3 Dropbox. If you work with a partner, only one person should submit the solution. However, to avoid losing 10 points, write both names in the BrightSpace Dropbox comment box. Deadline Reminder: Once the submission deadline passes, BrightSpace will no longer accept your Python submission and you will no longer be able to earn credit. Thus, if you are not able to fully complete the assignment, submit whatever you have before the deadline so that partial credit can be earned. Learning Outcomes To solve this problem, you need to understand the following new Python concept: dictionaries. Background Information The file pokedex.txt contains partial information about 30 Pokémon from this Pokédex. Assignment Using pokedex.py as a starting point, supply the missing functions such that interaction with a user could produce this transcript. Grading - 100 points 10 points. The function printMenu is correct. 10 points. The function printPokedex is correct. 10 points. The function howManyPokemon is correct. 10 points. The function howManyHitPoints is correct. 15 points. The function lookupByName is correct when the Pokémon is present (10 points) and absent (5 points). 15 points. The function lookupByNumber is correct when the number is present (10 points) and absent (5 points). 15 points. All output looks good and is easily understandable. (3 points for each type of improvement up to 15 points.) 15 points - The Python solution is properly commented, easy to understand and does not contain unnecessary code. (3 points for each type of improvement up to 15 points.) Honor's Lab The points you earn from the grading scale above will be multiplied by .9 for a maximum of 90 points. The other 10 points can be earned by enhancing the assignment in a creative, non-trivial manner. https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/ 1/2 10/16/2017 CSCI 127, Program 3 In the BrightSpace Dropbox comment box, describe your enhancement clearly. (You must include this comment to earn the additional points.) https://www.cs.montana.edu/paxton/classes/csci127/programs/program3/ 2/2 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: invalid That is not a number, try again. Enter a menu option: 10 That is not a valid choice, try again. Enter a menu option: 1 The Pokedex ----------- Number:1, Name: Bulbasaur, HP: 318, Type: grass and poison ----------- Number:2, Name: Ivysaur, HP: 405, Type: grass and poison ----------- Number:3, Name: Venusaur, HP: 525, Type: grass and poison ----------- Number:4, Name: Charmander, HP: 309, Type: fire ----------- Number:5, Name: Charmeleon, HP: 405, Type: fire ----------- Number:6, Name: Charizard, HP: 534, Type: fire and flying ----------- Number:7, Name: Squirtle, HP: 314, Type: water ----------- Number:8, Name: Wartortle, HP: 405, Type: water ----------- Number:9, Name: Blastoise, HP: 530, Type: water ----------- Number:10, Name: Caterpie, HP: 195, Type: bug ----------- Number:11, Name: Metapod, HP: 205, Type: bug ----------- Number:12, Name: Butterfree, HP: 395, Type: bug and flying ----------- Number:13, Name: Weedle, HP: 195, Type: bug and poison ----------- Number:14, Name: Kakuna, HP: 205, Type: bug and poison ----------- Number:15, Name: Beedrill, HP: 395, Type: bug and poison ----------- Number:16, Name: Pidgey, HP: 251, Type: normal and flying ----------- Number:17, Name: Pidgeotto, HP: 349, Type: normal and flying ----------- Number:18, Name: Pidgeot, HP: 479, Type: normal and flying ----------- Number:19, Name: Rattata, HP: 253, Type: normal ----------- Number:20, Name: Raticate, HP: 413, Type: normal ----------- Number:21, Name: Spearow, HP: 262, Type: normal and flying ----------- Number:22, Name: Fearow, HP: 442, Type: normal and flying ----------- Number:23, Name: Ekans, HP: 288, Type: poison ----------- Number:24, Name: Arbok, HP: 448, Type: poison ----------- Number:25, Name: Pikachu, HP: 320, Type: electric ----------- Number:26, Name: Raichu, HP: 485, Type: electric and psychic ----------- Number:27, Name: Sandshrew, HP: 300, Type: ground ----------- Number:28, Name: Sandslash, HP: 450, Type: ground ----------- Number:29, Name: Nidoran, HP: 275, Type: poison ----------- Number:30, Name: Nidorina, HP: 365, Type: poison ----------- End Pokedex 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 2 Enter a Pokemon name: raichu Number:26, Name: Raichu, HP: 485, Type: electric and psychic 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 2 Enter a Pokemon name: bridger The pokemon named Bridger does not exist 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 3 Enter a Pokemon number: 10 Number:10, Name: Caterpie, HP: 195, Type: bug 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 3 Enter a Pokemon number: invalid That is not a number, try again. Enter a Pokemon number: 50 Error: Pokemon number 50 does not exist 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 4 There are 30 different Pokemon 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 5 The total number of hit points for all Pokemon is 10715 1. Print Pokedex 2. Lookup Pokemon by Name 3. Lookup Pokemon by Number 4. Print Number of Pokemon 5. Print Total Hit Points of All Pokemon 6. Quit Enter a menu option: 6 Thank you. Goodbye!
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

I have uploaded the work in a zip fo...


Anonymous
Nice! Really impressed with the quality.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags