So what is a variable?
These things are what makes computer programes work
Lets us see if we can make some
Variables are little boxes inside the memory of the computer that store things.
Lets make on and put something in it.
Here is a simple program
box = 1 # Put 1 in a box
This line makes a variable box and puts the number 1 in it.
print box
We Print out what is in the variable box.
box = 1
print box
This is a comment. It doesn't do anything for the program. It is here to help you understand what is going on.
Lets make the program a bit easier to read.
There are solutions and more on the website
http://www.philipmrussell.co.uk/raspberrypi/programming/variables.html
No comments:
Post a Comment