Variables
Variables allow you to save a value for later use. This later use may be to display it or to perform further calculations. Whatever the reason variables form the backbone of most programs.
Some sample code to try –
x = 3 y = 8 z = x + y print "x is", x print "y is", y print "x + y is ",z
The code sample should print 11. Open up Geany or try it in the interactive editor below.
Helpful links
http://www.sthurlow.com/python/lesson03/
http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/variables.html
http://learnpythonthehardway.org/book/ex4.html
Test your skill!
x = 3 y = 8 z = x + y ??? =????? print z
Task – Add 2 to z by altering the code above. The easiest way to do it is to replace the ???? with new values.
Output: (clear)











