The reason indentations are not showing correctly is because we need to enclose chunks of code between a set of triple backticks (```). If not, markdown treats it as regular text and will automatically remove white spaces. I have edited your message to implement this for you. For more great tips and tricks on posting questions in the community, you may want to read this post.
This is to be expected since assessments are not as “guided” as regular lessons and require a bit of trial and error before we land on a solution. Out of curiosity, do you feel that this assessment is too hard for where you are on your learning path or is it just the right amount of “struggle?”
WELL…What an adventure this has been! I realized that in order to help you any further, I would need access to the dataset but since these assessments are still in beta testing, only a select few special people have access to them (like you, but not me!) I could not download the file (“pokemon starter.csv”) directly from the DQ platform like I could for any other regular lesson. So I tried to “get around” this by using the tool that us authors-of-assessments use to create the assessments in order to access the pokemon dataset from the “inside.” I really shouldn’t have attempted that until I finished my first morning coffee! I inadvertently discovered a bug, managed to foul up the file system, and still didn’t get the file! In the end, I managed to get the file with the help of @Bruno who also graciously cleaned up my mess. You’re my hero!
Once I did get my hands on “pokemon starter.csv” and played around with it (in conjunction with your code) I have finally figured out where things are going astray for you. Let’s dive in!
First thing is that we are comparing
fire_first and when it is less than (ie <) we are not updating the
fire_first variable for future comparisons. This is not the strategy we want because
fire_first started (randomly) as the first element of
fire_only just so we had something to compare to. If we don’t update this variable, we will continue comparing new Pokemons to this first entry. When we find an evolution time that is less than (column
23) we want to update our
water_first variables for future comparisons. For this reason, I changed the names of these variable to reflect that they are storing evolution min times. What I would suggest is to use something like this:
fire_min = fire_only
for rows in fire_only:
if rows < fire_min:
fire_min = rows # this will update the variable to a new `min` for future comparisons
fire_starter_pick = rows
Also, notice how I removed the print statement from inside the
for loop. This is why you were seeing two names for the
water_only list: the
if condition was being met twice and therefore printed two different names. Technically, we don’t need to print the names here. I think it’s better to update the
water_starte_pick variables inside the
for loop and once it is complete, print these variables outside the loop.
I hope this isn’t too much to follow but if it is, just let me know and we can work on it together some more.