Discussion Assignment

practice with loops and format strings

As always, you should bring a printed copy of your solutions to discussion with you. Sometimes your discussion assignment will be collected and graded as a take-home quiz.

1. Write a program that asks the user to enter 2 integers, and then computes the sum of the numbers between them.

Sample Run:
Please enter an integer: 5
Please enter an integer: 8

The sum of the integers from 5 to 8 is 26.

Sample Run:
Please enter an integer: 10
Please enter an integer: 7

The sum of the integers from 7 to 10 is 34.

Your program's output should match the sample output. 

2. Write a print statement that reads 3 integers from the user, and prints the average. The average should be printed with 2 digits after the decimal point.

Sample Run:
What is the integer? 21
What is the integer? 25
What is the integer? -3

The average of 21, 25, and -3 is 14.33.

Your program's output must match the sample output.