Lab Activity 6.1
Write the for loop that will print the following sequences of numbers, one per line.
(a) Integers from 3 up to and including 12
(b) Integers from 0 up to but not including 9, but with a step of 2 instead of the default of 1 (i.e., 0, 2, 4, 6, 8)
(c) Integers from 0 up to but not including 24 with a step of 3
(d) Integers from 3 up to but not including 12 with a step of 5
Lab Activity 6.2
Define, directly in the interactive shell, function perimeter() that takes, as input, the radius of a circle (a nonnegative number) and returns the perimeter of the circle. A sample usage is:
>>> perimeter(1)
6.283185307179586
>>> perimeter(2)
12.566370614359172
Remember that you will need the value of π (defined in module math) to compute the perimeter.
Lab Activity 6.3
Implement function average() that takes two numbers as input and returns the average of the numbers. You should write your implementation in a module you will name average.py.
A sample usage is:
>>> average (1,3)
2.0
>>> average (2, 3.5)
2.75