When the following code is executed line by line on shell, it is giving the expected output :
>>> name=input("Please give your full name : ")
Please give your full name : ins vikranth
>>> ListName=name.split(' ')
>>> outputString=ListName[1]+' '+ListName[0]
>>> print(outputString)
vikranth ins
The code is not running in total as a file but runs line by line on the shell. The code is :
name=input("Please give your full name : ")
ListName=name.split(' ')
outputString=ListName[1]+' '+ListName[0]
print(outputString)
The error message is :
Please give your full name : ins vikranth
Traceback (most recent call last):
File "ReverseName.py", line 1, in <module>
name=input("Please give your full name
File "<string>", line 1
ins vikranth
^
SyntaxError: unexpected EOF while parsing
Why is this happening?