Last active
October 13, 2023 04:05
-
-
Save jonathanhle/37120d326223597bfac2d6ca99b1a403 to your computer and use it in GitHub Desktop.
Revisions
-
jonathanhle revised this gist
Oct 10, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def get_evolution_chain(pokemon_name: str) -> list: pass ``` ## **Problem 5: Data Aggregation (Medium)** **Problem Statement:** -
jonathanhle renamed this gist
Oct 8, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jonathanhle created this gist
Oct 8, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,94 @@ # PokeAPI-based Coding Test Practice ## **Environment:** - Programming Language: Python (or your preferred language) - Libraries allowed: requests, json ## **Problem 1: Basic API Request (Easy)** **Problem Statement:** Write a function called `get_pokemon_name` that takes a Pokemon ID and returns the name of the Pokemon. ```python def get_pokemon_name(pokemon_id: int) -> str: pass ``` ## **Problem 2: Extracting Multiple Data (Easy)** **Problem Statement:** Given a Pokemon name, write a function called `get_pokemon_info` to retrieve the following details: - Name - Base experience - Height - Weight The function should return a dictionary. ```python def get_pokemon_info(pokemon_name: str) -> dict: pass ``` ## **Problem 3: Digging Deeper (Medium)** **Problem Statement:** Some Pokemon have multiple types (e.g., Water, Grass). Write a function called `get_pokemon_types` that retrieves all types for a given Pokemon. ```python def get_pokemon_types(pokemon_name: str) -> list: pass ``` ## **Problem 4: Handling Relationships (Medium)** **Problem Statement:** Pokemons evolve from one form to another. Write a function called `get_evolution_chain` that retrieves the entire evolution chain for a given Pokemon. Hint: You might need to explore the evolution-chain endpoint. ```python def get_evolution_chain(pokemon_name: str) -> list: pass ``` ## **Problem 5: Data Aggregation (Hard)** **Problem Statement:** Given a type of Pokemon (e.g., 'Water'), write a function called `average_base_experience` to calculate the average base experience for all Pokemon of that type. ```python def average_base_experience(pokemon_type: str) -> float: pass ``` ## **Problem 6: Advanced Filtering (Hard)** **Problem Statement:** Write a function called `filter_pokemon` that retrieves all Pokemon below a given height and weight and sorts them by their base experience in descending order. ```python def filter_pokemon(height: int, weight: int) -> list: pass ``` ## **Bonus Problem: Asynchronous Calls (Very Hard)** **Problem Statement:** Fetching each Pokemon's details sequentially can be time-consuming. Write an asynchronous function called `async_get_pokemon_details` that takes in a list of Pokemon names and retrieves their details concurrently. You might want to use `asyncio` and `aiohttp` for this task. ```python async def async_get_pokemon_details(pokemon_names: list) -> list: pass ```