Variables
One of the most basic concepts in computer programming is the variable. A variable is a word/identifier that hangs onto a singlevalue. For example, let's say you needed the number 5
for your program, but you're not going to use it immediately. You can set a variable, say spam
, to grab the value 5
and hang onto it for later use, like this:
spam = 5
Declaring variables in Python is easy; you just write out a name/identifier, like spam
, and use =
to assign it a value, and you're done!