0

So I wrote this function wich returns a meaning of a word that is in data.json. The problem is that the return works fine when I put some right word the first time, but after one exception it returns None.

def sig_palavra(p):
    p = p.lower()
    try:
        return str(data[p])
    except:
        print('Verifique se a palavra foi escrita corretamente')
        p = input(':')
        p = p.lower()
        sig_palavra(p)

I have this output:

> Digite a palavra pra saber seu significado: olho
> Verifique se a palavra foi escrita corretamente
>:eye
> None

But 'eye' is a valid word and it returns its meaning if I write it in the first place

0 Answers0