Tuesday 24 May 2011

Exercises Part 1

Here are a couple exercises to test your current knowledge. These should be completed in a new Python file.



Assign the value 20 to a variable called width.
Assign the value 10 to a variable called height.
Define a variable called area to store the result of width * height.
Display the area to the screen using the print() function. *HINT* See the screenshot in the last lesson.

Assign the value 10 to a variable called length.
Define a variable called area to store the result of length2. *HINT* See Python Arithmetic Operators
Display the area to the screen using the print() function.


Once you have completed both of the exercises above, continue on to the next lesson: Built-in Functions


-Nathan (everythingPython)

No comments:

Post a Comment