Program 4

Logistics

  • Due date: Monday, June 15th no later than 11:59 p.m.
  • Submission instructions: upload your solution, entitled YourFirstName-YourLastName-Program4.py to the BrightSpace Program 4 Dropbox.
  • 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 Python concepts: object-oriented programming and lists.

Background Information

The file pokedex.txt contains partial information about 31 Pokémon that mostly come 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

20 points. The class Pokemon is defined (2 points) with the appropriate six methods (3 points each):

  • the constructor
  • the __str__ method
  • a method that returns the Pokemon’s name
  • a method that returns the Pokemon’s number
  • a method that returns the Pokemon’s combat points
  • a method that returns the Pokemon’s types

5 points. The function print_menu is correct.

10 points. The function print_pokedex is correct.

10 points. The function lookup_by_name is correct when the Pokémon is present (7 points) and absent (3 points).

10 points. The function lookup_by_number is correct when the number is present (7 points) and absent (3 points).

10 points. The function total_by_type is correct when the type is present (7 points) and absent (3 points).

10 points. The function average_hit_points is correct.

10 points. The format of the output matches the format of the output in the transcript exactly. (2 points for each type of difference up to 10 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.)