I am trying to learn Python with this book "Automate the boring stuff with Python". However , I am stuck with the first code itself.
I have simple copied this code on my Editor File:
print('Hello world!')
print('What is your name?') # ask for their name
myName = input()
print('It is good to meet you, ' + myName)
print('The length of your name is:')
print(len(myName))
print('What is your age?') # ask for their age
myAge = input()
print('You will be ' + str(int(myAge) + 1) + ' in a year.')
In the Shell window I get the first two lines but as soon as I input my name, it gives me an error. I don't know what am I doing wrong.
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit
(AMD64)] on win32 Type "copyright", "credits" or "license()" for more
information.
>>> ================================ RESTART ================================
>>> Hello world! What is your name? Ashima
Traceback (most recent call last): File "C:\Users\sahnas01\Desktop\PYTHON\hello.py", line 4, in <module>
myName = input() File "<string>", line 1, in <module> NameError: name 'Ashima' is not defined