[Tutor] syntax error with raw input
Alan Gauld
alan.gauld at btinternet.com
Wed Nov 12 18:11:35 CET 2014
On 12/11/14 11:08, Vaibhav Banait wrote:
> Hi
> I am new to python. I learnt (!) using raw_input a day back. Attempt to
> use has resulted in error. I am not able to spot a problem in syntax. I
> am using python 3.4.2. Kindly help
Looks like you are reading a v2 book/tutorial but using v3.
In v3 several key changes were made to Python including the renaming of
raw_input() to input().
The other big change was making print a function so you now *must* put
parentheses around anything you want to print.
ie
print 'hello' # Python v2
becomes
print('hello') # python v3
There are numerous other small changes so it would be better for you to
either find a v3 tutorial (you could try mine! :-) or install Python
v2.7 while you are learning.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list