What is the difference between literal and variables in Python? -
i'm beginner user python, confused between literal , variables.
this know literal: "a"+"b"
and variables: sentence="a"+"b"
a literal notation representing fixed (const
) value.
variable storage location associated symbolic name (pointed to, if you'd like).
it's best explained in use:
foo = bar(42) ^ ^ ^ | | |--- literal, 42 *literally* 42 | |------- function, represents "something" in memory |------------- variable, named "foo", , content may vary (is variable)
Comments
Post a Comment