Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

difference between variable and assignment statement in python?

Update:

and an example of them. i thought anythiing before an = sign is a variable, but then it seems like elsewhere its an assignment statement?

1 Answer

Relevance
  • 7 years ago

    A "variable" is simply the concept of a named place where you can store data. You can use them in assignment statements to assign them a different piece of data.

    For example:

        x = 5

    - The whole thing (x = 5) is called an assignment statement.

    - The left-hand-side (x) of the statement is the place where you want to assign the data to, in this case a variable with the name x.

    - The = is simply there to indicate that this is an assignment statement (you could call it the "assignment operator").

    - The right-hand side (5) is the data you want to assign.

    Assignment statements are everywhere you use an = to assign a right-hand-side piece of data to a left-hand-side location. Variables are named places where you can store data. They may used as part of an assignment statement.

Still have questions? Get your answers by asking now.