Sunday, 15 January 2012

error in python program -



error in python program -

i tried simple python program:

x == 3 print x

but error:

traceback (most recent phone call last): file "", line 1, in nameerror: name 'x' not defined

why?

== comparison, not assignment. you're asking if x equal 3, haven't told python x yet.

you want this:

x = 3 print x

python

No comments:

Post a Comment