Created
June 18, 2020 11:43
-
-
Save kurzweil777/38a1f85b20118530ddd07078c614e8d5 to your computer and use it in GitHub Desktop.
Exercise from code_wars
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 characters
| class PokeScan: | |
| """The task: https://bit.ly/3hycrA2""" | |
| characters = {"water": "wet", "fire": "fiery", "grass": "grassy"} | |
| def __init__(self, name, level, pkmntype): | |
| self.name = name | |
| self.level = level | |
| self.pkmntype = pkmntype | |
| if level in range(0, 21) or level < 0: | |
| self.level_character = "weak" | |
| elif level in range(21, 51): | |
| self.level_character = "fair" | |
| else: | |
| self.level_character = "strong" | |
| def info(self): | |
| return f'{self.name}, a {"".join([self.characters[poke] for poke in self.pkmntype.split()])} ' \ | |
| f'and {self.level_character} Pokemon' | |
| pikachu = PokeScan("Pikachu", 50, "grass") | |
| print(pikachu.info()) # Pikachu, a grassy and fair Pokemon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment