Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me solve this python question. Please use basic python and not advanced python. In main.py, write `from pokemon import Pokemon`. Fill a list

Please help me solve this python question. Please use basic python and not advanced python.

In main.py, write `from pokemon import Pokemon`.

Fill a list `pokemon_list` with 5 Pokemon objects: in a loop, randomly choose a row from the dataframe (suggestion: use the dataframe's [sample](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sample.html?highlight=sample#pandas.DataFrame.sample) method to get a dataframe with a single random row, then call [reset_index](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.reset_index.html?highlight=reset_index#pandas.DataFrame.reset_index) so the row index is 0). With values from the relevant columns in the sampled row, instantiate a Pokemon object and add the object to the `pokemon_list`.

Select the first two Pokemon from your list, and have them battle! In a loop, call the method `defend` on `pokemon_list[0]` passing as argument `pokemon_list[1]` and print the result of the combat (you can be dramatic!). Then alternate and let `pokemon_list[1]` defend against `pokemon_list[0]`. Continue the loop until one of the Pokemon has 0 or less HP points. Print the name of the winner and the loser...

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