Monday, 9 April 2012

More Python Programming

The Python Programming tutorial continues. Looking at simple variables, and using them in simple loops. Counters and loops are important to programming. They for the basis of most of the programming structures.

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.
Here is the code
box = 1
print box
What's that thing after the 1
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