with open('whatever stuff is neede/all pokemons.txt', 'r',encoding='latin-1') as a: all_pokemons = a.read().split(',') with open('whatever stuff is neede/evolvable pokemons.txt', 'r',encoding='latin-1') as a: evolvable_pokemons = a.read().split(',') import csv with open('whatever stuff is neede/all.csv', 'r', encoding='latin-1') as stone: stone = {i[0].lower():i[2] for i in list(csv.reader(stone, delimiter=","))} import difflib if __name__=='__main__': pokemon = input('Can it evolve?????? ').lower() stuff = difflib.get_close_matches(pokemon, all_pokemons, n=1, cutoff=0) if len(stuff)==0: print(f'sry `{pokemon}` pokemon not found (idk why)') else: stuff=stuff[0].title() from difflib import SequenceMatcher as SM if SM(None, pokemon.title(), stuff).ratio()<0.6: print(f'NOTE idk if u meant {stuff} or not tho but thats the closest match') if stuff.lower() in stone: print(f'YES {stuff} can evolve: {stone[stuff.lower()]}') else: print(f'NO {stuff} can\'t evolve') def isisisisis(pokemon,all_pokemons=all_pokemons, evolvable_pokemons=evolvable_pokemons,stone=stone): if len(pokemon) ==0: return 'Write pokemons name (it uses fuzzy search)' stuff = difflib.get_close_matches(pokemon, all_pokemons, n=1, cutoff=0) if len(stuff)==0: return f'sry `{pokemon}` pokemon not found (idk why)' else: stuff=stuff[0].title() from difflib import SequenceMatcher as SM #if SM(None, pokemon.title(), stuff).ratio()<0.6: print(f'NOTE idk if u meant {stuff} or not tho but thats the closest match') if stuff.lower() in stone: return f'YES {stuff} can evolve: {stone[stuff.lower()]}' else: return f'NO {stuff} can\'t evolve'