[Tutor] difference between expressions and statements

Jared Nielsen nielsen.jared at gmail.com
Wed Apr 9 18:49:27 CEST 2014


Hi Pythons,
Could someone explain the difference between expressions and statements?
I know that expressions are statements that produce a value.
I'm unclear on functions and especially strings.
Are any of the following expressions?

print(42)
print("spam")
spam = 42
print(spam)

Is the first example producing a value or simply displaying an integer?
Does a string count as a value?
Is a variable assignment considered a value?
If I print a variable is that considered production of a value?

Thanks!


More information about the Tutor mailing list