Program 4: Pokemon
Logistics
- Due Date: Sunday, June 13th no later than 11:59 p.m.
- Partner Information:You may complete this assignment individually or with exactly one partner.
- Submission Instructions (working alone): Upload your solution (.py file), entitled YourFirstName-YourLastName-Program4.py to the BrightSpace(D2L) Program 4 Dropbox.
- Submission Instructions (working with a partner): Upload your solution (.py file), entitled YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Program4.py to the BrightSpace(D2L) Program 4
- Deadline Reminder: Late passes can be used on this assignment. However, if you do not use a late pass and submit it past the deadline, you submission will lose some points (see late assignment policy). After 48 hours,
the dropbox will close and you will no longer be able to submit
In order to complete this lab, you will need to understand
- Object Oriented Programming
- Dictionaries
- Files (reading)
- ... and mostly everything else we've talked about this semester
Background Information
- Pokemon is the immensely popular video game and TV show that is all about the world of Pokemon. Pokemon are creatures of all different kinds of shapes and sizes that the players can catch and battle with. A Pokedex
is a "electronic Pokemon encyclopedia" that contains information about all the different Pokemon that exist. You will be writing a program that simulates a Pokedex
To see all the different Pokemon that exist, check out this list of pokemon
Assignment
- Using program4.py (renamed according to the
instructions above) as a starting point,
supply the missing functions, missing class, and missing class methods. In addition the the class definition and methods, You will need to implement four different functions:
- The create_pokedex function should read in from pokemon.csv and fill a list with information about each Pokemon. The CSV file contains information about every Pokemon that has been created since 1996. At the end of this function, you should return the filled list
- For each Pokemon in the file, you should create a Pokemon object and store it inside of the list you created
For this assignment, each Pokemon should have:
- Number-This is the Pokedex number for the Pokemon (For example, Bulbasaur has the number 1)
- Name- This is the name of the Pokemon (For example, Bulbasaur)
- Types-This is the type(s) of the Pokemon. A Pokemon can have one type, or two types. (Bulbasaur is a grass and poison type, but Pikachu is just an electric type). You should store these types as a list
- Stat Total-This is the total battle stats of the Pokemon (Bulbasaur has a stat total of 318)
- Generation-This is the generation the Pokemon was introduced in (For example, Bulbasaur was part of generation 1, which was released in 1996)
- Legendary-This is whether or not the Pokemon is a powerful legendary Pokemon (For example, Bulbasaur is not a legendary, but Mewto is a legendary). The value for this will either be "TRUE" or "FALSE"
- For all remaining functions,
you should NOT open the file anymore
. You should only be using your list of Pokemon objects
- The function lookup_by_number should allow the user to search for a Pokemon in the list by number. If there is Pokemon with that number, it should print out information for that Pokemon, such as the name, number, type, stat total, and generation (see sample output)
If there is not a Pokemon with that number, then your function should print out "There is no Pokemon with a number of __"
- The function lookup_by_name should allow the user to search for a Pokemon in the list by name. If there is Pokemon with that name, it should print out information for that Pokemon, such as the name, number, type, stat total, and generation (see sample output)
If there is not a Pokemon with that name, then your function should print out "There is no Pokemon named __". Your function should work for input of uppercase, lowercase, or a mixture of both
- The function total_by_type should allow the user to enter a type of Pokemon (i.e. Fire) and your function should count the number of Pokemon that have that typing. If there are no matches, then "_____ Pokemon do not exist" should be printed out
- The function number_per_generation should find the total number of Pokemon for each generation. You will need to create and fill a Dictionary. If you do not use a dictionary, you will lose points . The keys for your dictionary should be
the generation (i.e. 1,2,3, etc) and the values should be the number of Pokemon that are part of that generation (i.e. 151, 99, 139,etc). Your function needs to return the dictionary. Do not print anything else.
- You will also need to add in all the necessary class methods. Including your constructor, you should have 6 methods in total in your Pokemon class (if you have more, that is fine)
Sample output/transcripts
When your program is run, an interaction with a user could produce:
Starting code
- program4.py
- pokemon.csv (note to the Pokemon fans: this file excludes all mega evolutions and gigantamax forms)
Helpful examples from class
- billionaire_oop.py for how to create objects using information from a file and how to iterate through data structure of objects for certain functions
Grading - 100 points
- 15 points- The create_pokedex() is defined and returns a list with Pokemon Objects
- 5 points- The Pokemon class is correctly defined
- 10 points- The constructor and other needed methods for the Pokemon class are correct
- 15 points- The lookup_by_number function is implemented correctly and displays the correct output
- 15 points- The lookup_by_name function is implemented correctly and displays the correct output
- 15 points- The total_by_type function is implemented correctly and displays the correct output
- 15 points- The number_per_generation function is implemented correctly and returns the correct dictionary
- 10 points- The sample output is matched and instructions for the assignment were followed