Question: Expectations All functions for this part of the assignment should be written in hw2_manual.py For this part of the assignment, you may import the math
Expectations
- All functions for this part of the assignment should be written in hw2_manual.py
- For this part of the assignment, you may import the math module, but you may not use any other imports to solve these problems.(no panda, no csv plz)
Analysis
For this step of the assignment, you will be implementing various functions to answer questions about the dataset.
Each function should take the list returned by the cse163_utils.parse function (provided for you) as the first argument, along with any other arguments specified in each problem. For example, for the third function, we would call filter_range(data, 1, 10) where data was the list returned by cse163_utils.parse.
This data structure should not be modified by any function you write. Every problem that deals with strings should be case-sensitive (this means "chArIzard" is a different species than "Charizard"). You may make the following assumptions about the inputs:
- You may assume the given list is non-empty for all functions you implement.
- For each problem, you may assume we pass parameters of the expected types described for that problem and that those parameters are not None.
- You should make no other assumptions about the parameters or the data.
For each of the problems, we will use the file pokemon_test.csv to show what should be returned.
id,name,level,personality,type,weakness,atk,def,hp,stage 59,Arcanine,35,impish,fire,water,50,55,90,2 59,Arcanine,35,gentle,fire,water,45,60,80,2 121,Starmie,67,sassy,water,electric,174,56,113,2 131,Lapras,72,lax,water,electric,107,113,29,1
Problem 1: species_count
Write a function species_count that returns the number of unique Pokemon species (determined by the name attribute) found in the dataset. You may assume that the data is well formatted in the sense that you don't have to transform any values in the name column.
For example, assuming we have parsed pokemon_test.csv and stored it in a variable called data:
species_count(data) # 3(should return)
Problem 2: max_level
Write a function max_level that finds the Pokemon with the max level and returns a tuple of length 2, where the first element is the name of the Pokemon and the second is its level. If there is a tie, the Pokemon that appears earlier in the file should be returned.
For example, assuming we have parsed pokemon_test.csv and stored it in a variable called data:
max_level(data) # ('Lapras', 72) Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
