Professor Oak has just begun learning Python and he wants to program his new Pokedex prototype with it.

For a starting point, he wants to instantiate each scanned Pokemon as an object that is stored at Pokedex's memory. He needs your help!

Your task is to:

1) Create a ```PokeScan``` class that takes in 3 arguments: ```name```, ```level``` and ```pkmntype```.

2) Create a ```info``` method for this class that returns some comments about the Pokemon, specifying it's name, an observation about the ```pkmntype``` and other about the ```level```.

3) Keep in mind that he has in his possession just three Pokemons for you to test the scanning function: ```Squirtle```, ```Charmander``` and ```Bulbasaur```, of ```pkmntypes``` ```water```, ```fire``` and ```grass```, respectively.

4) The ```info``` method shall return a string like this:
```Charmander, a fiery and strong Pokemon.```

5) If the Pokemon level is less than or equal to 20, it's a ```weak``` Pokemon. If greater than 20 and less than or equal to 50, it's a ```fair``` one. If greater than 50, it's a ```strong``` Pokemon.

6) For the ```pkmntypes```, the observations are ```wet```, ```fiery``` and ```grassy``` Pokemon, according to each Pokemon type.

IMPORTANT: The correct spelling of "Pokémon" is "Pokémon", with the ```"é"```, but to maximize the compatibility of the code I've had to write it as ```"Pokemon"```, without the ```"é"```. So, in your code, don't use  the ```"é"```.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def __init__(self, name, level, pkmntype):
	

Solutions:
class PokeScan:

	def __init__(self, name, level, pkmntype):
		self.name = name
		self.level = level
		self.pkmntype = pkmntype

	def info(self):
		level_info = 'weak' if self.level <= 20 else 'fair' if self.level <= 50 else 'strong'
		pkmntypes_info = {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}
		return '{}, a {} and {} Pokemon.'.format(self.name, pkmntypes_info[self.pkmntype], level_info)


class PokeScan:

	def __init__(self, name, level, pkmntype):
		self.name = name
		self.level = level
		self.pkmntype = pkmntype

	@property
	def element(self):
		return {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}.get(self.pkmntype, '?')

	@property
	def strength(self):
		return 'strong' if self.level > 50 else 'fair' if self.level > 20 else 'weak'

	def info(self):
		return '{}, a {} and {} Pokemon.'.format(self.name, self.element, self.strength)


class PokeScan:

	def __init__(self, name, level, pkmntype):
		self.name = name
		self.level = level
		self.pkmntype = pkmntype

	def level_description(self):
		if 20 < self.level <= 50:
			return 'fair'
		elif self.level > 50:
			return 'strong'
		return 'weak'

	def info(self):
		return {'water': '{}, a wet and {} Pokemon.', 'fire': '{}, a fiery and {} Pokemon.', 'grass': '{}, a grassy and {} Pokemon.'}[self.pkmntype].format(self.name, self.level_description())


class PokeScan:
	LVL_CONVERT = [(20, 'weak'), (50, 'fair'), (float('inf'), 'strong')]
	TYPE_CONVERT = {'fire': 'fiery', 'water': 'wet', 'grass': 'grassy'}

	def __init__(self, name, level, typ):
		(self.name, self.lvl, self.typ) = (name, level, typ)

	def info(self):
		return f'{self.name}, a {self.TYPE_CONVERT[self.typ]} and {self.getLvlKind()} Pokemon.'

	def getLvlKind(self):
		return next((v for (th, v) in self.LVL_CONVERT if self.lvl <= th))


class PokeScan:

	def __init__(self, name, level, ptype):
		self.name = name
		self.level = level
		self.ptype = ptype

	def strength(self):
		return 'strong' if self.level > 50 else 'fair' if self.level > 20 else 'weak'

	def obs_type(self):
		return {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}.get(self.ptype, 'unknown')

	def info(self):
		return '%s, a %s and %s Pokemon.' % (self.name, self.obs_type(), self.strength())


import enum

class PokemonType(enum.Enum):
	Water = (1,)
	Fire = (2,)
	Grass = 3

	@classmethod
	def from_string(cls, type_str):
		return {'water': cls.Water, 'fire': cls.Fire, 'grass': cls.Grass}[type_str]

	def __str__(poketype):
		return {PokemonType.Water: 'wet', PokemonType.Fire: 'fiery', PokemonType.Grass: 'grassy'}[poketype]

class PokeScan(object):

	def __init__(self, name, level, pokemon_type):
		(self.name, self.level) = (name, level)
		self.pkmntype = PokemonType.from_string(pokemon_type)

	@property
	def strength(self):
		if self.level <= 20:
			return 'weak'
		return 'fair' if self.level <= 50 else 'strong'

	def info(self):
		infos = {'name': self.name, 'type': str(self.pkmntype), 'strength': self.strength}
		return '{name}, a {type} and {strength} Pokemon.'.format(**infos)


class PokeScan:

	def __init__(self, name, level, pkmntype):
		self.name = name
		self.level = level
		self.pkmntype = pkmntype

	def info(self):
		type_words = {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}
		outstring = self.name + ', a '
		outstring += type_words.get(self.pkmntype) + ' and '
		if self.level <= 20:
			outstring += 'weak'
		elif self.level <= 50:
			outstring += 'fair'
		else:
			outstring += 'strong'
		outstring += ' Pokemon.'
		return outstring


class PokeScan:

	def __init__(self, name, level, pkmntype):
		self.info = lambda : '{}, a {} and {} Pokemon.'.format(name, {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}[pkmntype], ['weak', 'fair', 'strong'][(level > 20) + (level > 50)])


class PokeScan:

	def __init__(self, name, level, pokemon_type):
		adjective = {'water': 'wet', 'fire': 'fiery', 'grass': 'grassy'}[pokemon_type]
		rank = 'weak' if level <= 20 else 'fair' if level <= 50 else 'strong'
		self.info = lambda : f'{name}, a {adjective} and {rank} Pokemon.'