Thursday, 19 April 2012

Simple Calculations in Python

Simple Calculations




Let us do a simple sum
We will make 3 variables.
box, bigbox and answer. We will put 2 in the box, 12 in bigbox and nothing in answer.
Here is the code
box = 2 # Put 2 in a variable box
bigbox = 12 # Put 12 in another variable box
answer = 0 # Here is an empty box containing nothing
answer = box + bigbox
print "The answer is ",answer

Now its your go.

Make three variables, first , second and result.
Put 2 in first, 3 in second and nothing in result.
Add the numbers up in the program and then print the answer.

No comments:

Post a Comment