Practice Questions: Compound Conditionals, Loops and Functions


1. Write a program that prompts the user for 3 integers - store those 3 values in variables x, y and z. While at least one of these variables is less than 100, print the values of all 3 variables and then add 5 to the value of both x and y, and add 10 to the value of z.

2. Write a function randomTriple that takes two arguments a and b, and returns a tuple containing 3 random integers that are between a and b. You may assume that a <= b.

3. Write an area function that takes two arguments length and width, and returns the area of a rectangle with the specified dimensions. Then write a main function that prompts the user for the dimensions of 10 rectangles, prints the area for each, and prints the dimensions and area of the smallest and largest rectangle.