Problems using samples

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Jun 26 13:22:58 EDT 2002


On 26-Jun-2002 Raphael Ribeiro wrote:
> 1 x = 8
> 2 y = 4
> 3 v = x - y
> 4
> 5 print v
> 6 if x = y:
> 7     print "Eles são o mesmo valor"
> 8     else:
>               print "Eles não são iguais , manja?"
> 
> this is my code, it says there's an error in line 6, but i can't find
> what **** error is that, can anyone help me?

you are not allowed to do an assignment inside of a control statement.

if foo = 2: # invalid

while line = readline(): # invalid

did you mean to use:

if x == y? if not the python idiom is:

x = y
if x:
  # do something





More information about the Python-list mailing list