1
I am learning to program in python and I have this following problem in an exercise. When running the code happens this following error:
vogal = (a,e,i,o,u)
NameError: name 'a' is not defined.
I have tried to solve by typing some other codes, writing the same code in other ways and even then I continue with the error.
vogal = [a,e,i,o,u]
letra = input("Digite uma letra: ")
if letra in vogal:
print('esta letra é uma vogal')
else:
print('esta letra não é uma vogal')
If the intention was that a,e,i,o,u were strings, literal values, put them in quotes:
vogal = ["a","e","i","o","u"]
– Daniel Mendes
Oops, it worked out, thank you very much, I hadn’t paid attention to this little detail. I ended up thinking it was a more complicated problem but no. Hugs
– Pedro Viero