3
I ran this same code with just a few minor differences in syntax to suit the right mode of script in Python version 2.7.9 and also in Python 3.4.2
Script I ran in Python 2:
name=input("tell me your name:")
print 'Hello',str(name),'!'
root@hikerpath:~/Área de trabalho# python teste3.py tell me your name:joao Traceback (most recent call last): File "teste3.py", line 1, in <module> name=input("tell me your name:") File "<string>", line 1, in <module> NameError: name 'joao' is not defined root@hikerpath:~/Área de trabalho#
Script I ran in Python 3:
name=input("tell me your name:")
print("Hello",str(name),"!")
root@hikerpath:~/Área de trabalho# python3 teste2.py tell me your name:joao Hello joao ! root@hikerpath:~/Área de trabalho#
What is missing from the code I have placed in Python 2, to give the error of string?
Another tip, instead of error images, post the error directly as text, read more about this at: https://pt.meta.stackoverflow.com/a/5485/3635 See more ;)
– Guilherme Nascimento
@Guilhermenascimento I understood, only in this case, the image is of the result, to prove that it gave error. the code itself is as text. but I’ll be careful with pictures next time.
– h1k3r
If you click with the mouse and drag over the terminal you will notice that it is possible to copy the result of the screen, except when it comes to layouts and Guis. I’m writing one of the reasons why images are mostly bad, especially because a lot of people don’t know, but there are visually impaired programmers (believe it or not, they use screen readers and images are interpretable as text for readers). As soon as I finish posting on the subject I send you ;)
– Guilherme Nascimento
@Guilhermenascimento Just and Perfect!!! Inclusion is everything! We don’t usually think about this kind of detail!
– h1k3r