Programming for Business –
Assignment # 4
Topics: Repetition Structures in Python (For Loops, While Loops)
Total Questions: 6
Instructions:
• Submit a Word file with attached screenshots of outputs.
• Submitting .py files is optional.
• Use either for or while loop for each question
Question 1: Miles to Kilometers Table
Write a program that displays a table of distances in miles and their equivalent distances in
kilometers, rounded to 2 decimal places. One mile is equivalent to 1.60934 kilometers. The
table should be generated using a loop, and should include values in 10 mile increments from
10 to 80.
Question 2: Average Word Length
Write a program with a loop that repeatedly asks the user to enter a word. The user should
enter nothing (press Enter without typing anything) to signal the end of the loop. Once the
loop ends, the program should display the average length of the words entered, rounded to
the nearest whole number.
Question 3: Ocean Levels
Assuming the ocean’s level is currently rising at about 1.6 millimeters per year, create an
application that displays the number of millimeters that the ocean will have risen each year
for the next 25 years.
Question 4: Tuition Increase
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.
Question 5: Calories Burned
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.
Question 6: Text Concatenation
Starting with a variable text containing an empty string, write a loop that prompts
the user to type a word. Add the user’s input to the end of text and then print the
variable. The loop should repeat while the length of text is less than 10 characters.