> Could someone explain the difference between expressions and statements?
>
> I know that expressions are statements that produce a value.

Yes, that's pretty much it.  If you can point your finger at the thing
and say that it produces a value, it's an expression.


> Are any of the following expressions?
>
> print(42)
> print("spam")
> spam = 42
> print(spam)

See:

    https://docs.python.org/2/reference/expressions.html

Technically, the only things that count as expressions have to fit the
shape of something described in that documentation link.



Your question about assignment being an expression or not is something
you can find out by seeing where "Assignment statements" show in:

    https://docs.python.org/2/reference/index.html


Good luck!
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to