I start learning Python just 2 days ago, so i think the question is really stupid. Here it goes.
Numero = raw_input ("Escreve um numero")
def detecta_erro(Numero):
if int(Numero) == 1: # I thaught this was a boolean, but ok just with number 1
correcto = int(Numero)
print type (correcto)
return correcto
else:
print "Nao e um numero"
return
print detecta_erro(Numero)
How do i make a boolean to detect if the user is writing a mumber or a string?
Even in the #comments, Python doesn’t accept (é, ã), can i force it?
I already search in Python documentation, but there are so many things in there, that i’m still lost.
Thank you very much.
Learn how to program it’s very dificult if you have just one or two books for guide. Everyone thinks diferent and, if you have diferent places to get information, it’s easier to understand some things in one place, others in other place.
I saw somewhere (here on in Blender.org) this link ( http://www.greenteapress.com/thinkpython/ ) and started here, but i think this book touch alot of points, but very soft in each one.
Your PDF came just in time!!!
Thank you again!!
ps- If i saw some more places with concise information, i’ll post it here.