Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me solve this python question. Please don't use any built in functions. Please use basic python not advanced. Thanks Pokemon data source: https://gist.github.com/leimd

Please help me solve this python question. Please don't use any built in functions. Please use basic python not advanced. Thanks

Pokemon data source: https://gist.github.com/leimd

Pokemon.csv file: https://gofile.io/d/vbb6xx

make a main.py file then load the file pokemon.csv into a dataframe, and answer the following questions through Python code:

1. How many Pokemon are there in each TYPE 1 category?

2. What are the average ATK (attack point) for each TYPE 2 category?

3. Are there any types which are only in Type 1 or Type2 but not both? (e.g., water is a type in both Type 1 and Type 2 series, is there any which is not?) Suggestion: a [set](https://docs.python.org/3.8/library/stdtypes.html#set) constructor can take a Series e.g., `myset = set(series)`, and then you canuse the symmetric difference operator

4. What is the average HP (hit points) of a 'Fire' type Pokemon (either Type 1 or Type 2)

5. Which POKEMON has the largest absolute-value difference between ATK and DEF (suggestion: you can subtract a series from another, and the `abs` function works with Series; [idxmax](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.idxmax.html?highlight=idxmax#pandas.DataFrame.idxmax) might be useful to use with `loc` or `at`)

PART 2 -----------------------------------------------------------------------------------------------------------------------------------------------------------------

In a file named pokemon.py, code a class that represents the template of a Pokemon. Any Pokemon has the following attributes:

* name(e.g., the Pokemon, such as 'Bulbasaur')

* type1 (e.g., 'Grass', 'Fire' etc)

* hp

* attack

* defense

It has one method: `defend`. `defend` takes an `opponent` Pokemon object as a parameter. The method generates a random integer between 0 and the opponent's attack points to find the damage that can be caused in the attack. It then gets a random integer between 0 and its defense points, and uses this to decrease the damage caused (the least damage possible is 0). Its hp (hit points) will be decreased by the net damage. The method returns the damage inflicted

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

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions