CSE 110: Introduction to Programming

W05 Team Activity: Lists of Numbers

Team Activity Overview

For this assignment you need to meet with your team and work together to help each person on the team understand the concepts.

Keep in mind that the goal of this activity is to work together and teach and learn from one another. The vision is to help everyone understand the material rather than moving through it as quickly as you can.

Instructions

Ask the user for a series of numbers, and append each one to a list. Stop when they enter 0.

Once you have a list, have your program do the following:

Core Requirements

Work through these core requirements step-by-step to complete the program. Please don't skip ahead and do the whole thing at once, because others on your team may benefit from building the program up slowly.

  1. Compute the sum, or total, of the numbers in the list.

  2. Compute the average of the numbers in the list.

  3. Find the maximum, or largest, number in the list.

The following shows the expected output:


Enter a list of numbers, type 0 when finished.
Enter number: 18
Enter number: 36
Enter number: 2
Enter number: 48
Enter number: 6
Enter number: 12
Enter number: 9
Enter number: 0
The sum is: 131
The average is: 18.714285714285715
The largest number is: 48

Stretch Challenge

Once you have finished the core requirements, you are welcome to move on to the stretch challenges. These can be more difficult and may require finding solutions that weren't directly covered in the reading. These aren't specifically required for the assignment, but are a great chance to dive deeper into the concepts of the lesson.

  1. Have the user enter both positive and negative numbers, then find the smallest positive number (the positive number that is closest to zero).

  2. Sort the numbers in the list and display the new, sorted list. Hint: There are python libraries that can help you here, try searching the internet for them.

The following shows the expected output after completing the stretch challenges:


Enter a list of numbers, type 0 when finished.
Enter number: 3
Enter number: 5
Enter number: 7
Enter number: 3
Enter number: 2
Enter number: -1
Enter number: -4
Enter number: -8
Enter number: 0
The sum is: 7
The average is: 0.875
The largest number is: 7
The smallest positive number is: 2
The sorted list is:
-8
-4
-1
2
3
3
5
7

Sample Solution

When your program is finished, please view the sample solution for this program to compare it to your approach.

You should work to complete this team activity for the one hour period first, without looking at the sample solution. However, if you have worked on it for at least an hour and are still having problems, you may feel free to use the sample solution to help you finish your program.

Submission

When you have finished your team meeting, you are welcome to continue working on your own. Feel free to include that additional work when you report on your progress in Canvas.

When you are finished:

Up Next

Other Links: