Variables: Difference between revisions

From Computer Science Wiki
No edit summary
Line 26: Line 26:
<html>
<html>
<iframe width="560" height="315" src="https://www.youtube.com/embed/G41G_PEWFjE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/G41G_PEWFjE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>
You should also look at:
<html>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ijjVDBPwA1o" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>
</html>



Revision as of 07:59, 18 June 2019

Programming basics[1]

The official definition: in computer programming, a variable is a storage location paired with an associated symbolic name (an identifier) which contains a value.[2]

In other words, a variable is a storage location for data. Variables have names. Some computer language mandate you assign a data type to variables. When asked for the "official definition" (or best definition) please use the definition stated above.

Variable in Python[edit]

name = "Mr. MacKenty"
position  = "Teacher"

# in the example above, we have a variable with the name "name" and the '''value''' of that variable is a string, "Mr. MacKenty"
# there is also a variable named "position" and the value of that variable is "Teacher". In memory, a section of memory has been reserved for a variable with the name "name" and "position".  

# variables can change. For example, if we wanted to change the variable position, we could simply: 

position = "New Teacher"

# now the value of "position" is "New Teacher".

See also[edit]

You should also look at:

Standards[edit]

  • Define the terms: variable, constant, operator, object.

References[edit]