python programming
COMP 3140
Assignment#3
Due on or before 6/17/2016 at 2:00PM
All programs should be written using Python programming language
Each question should be saved in a file name following the format Q#.py. Put all programs in one folder, name it HW3_YourName, compress it, and submit to Dropbox.
Q1) Write a program that uses loops to draw this pattern (first raw we have 0 white space, second raw 1 white space,
third raw 2 white spaces, fourth raw 3 white spaces, and finally 4 white spaces)
##
# #
# #
# #
# #
Q2) Running on a particular treadmill you burn 4.2 calories per minute. Write a program that uses a loop to display the
number of calories burned after 10, 15, 20, 25, and 30 minutes.
Q3) Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will
iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for
that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the
average rainfall per month for the entire period.
Q4) At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will
increase by 3 percent each year for the next 5 years. Write a program with a loop that displays the projected semester
tuition amount for the next 5 years.
Q5) Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored
in a list. Use a loop to calculate the total sales for the week and display the result.