Python Classroom
  • Introduction
  • About Python Classroom
  • Python Cloud Options
    • CS50 IDE
      • CS50 IDE Overview
      • CS50 IDE and Python
      • CS50 IDE Debugging
      • CS50 IDE Shortcuts
      • Linux Bash Shell
      • Vim Mode
        • Vim Tutorial
    • CS50 Sandbox
    • PythonAnywhere
    • Repl.it
  • Python Curriculum Map
    • Pedagogy
      • Python Professional Development
      • Teaching Tips
      • Assessment Tips
      • Rubrics
      • Activities
        • Picture Activity
        • Map Activity
        • Crossing the Bridge
        • NIM
        • Mastermind
        • Cards
          • Card Deck Algorithms
          • Sorting Cards
        • River Crossing
          • Jealous Boyfriends
          • Cannibals and Priests
          • Family
          • Police and the Thief
          • Humans and Monkeys
          • Moving Money
        • Crossing the River
        • Traveling Salesperson
        • Logic Problems
        • CIA Crack the Code
        • IQ Test
        • Puzzles
    • AP Computer Science Principles Framework
  • Python Philosphy
    • How to Practice Python
  • microbit
  • Turtle Graphics
    • Turtle Examples
    • Turtle Activities
    • Turtle Maze Problems
    • Turtle Graphics with loops
    • Turtle Snake
    • Turtle Graphics with Conditionals
  • Output
    • Output Examples
    • Output Mistakes
  • Variables
    • Variable Data Type Examples
    • Variable Role Examples
    • Variables Mistakes
    • Variables Problems
  • Math
    • Math Examples
    • Math Mistakes
    • Math Problems
    • Math Self Check
  • Input
    • Input Examples
    • Input Mistakes
    • Input Problems
  • Decisions
    • if
      • if Examples
      • if Mistakes
      • if Problems
    • if else
      • if else Examples
      • if else Problems
      • if / if else Problems
    • if elif else
      • if elif else Examples
      • if elif else Problems
    • nested if
      • nested if Examples
      • nested if Problems
    • Logical Operators
      • Logical Operators Examples
    • Adventure Game Project
  • Loops
    • while loop - count up
      • Examples
      • Problems
    • while loop - countdown
      • Examples
      • Problems
    • while loop - sentinel value
      • Problems
    • while loop - sentinel menu
      • Problems
    • for loop - range (one argument)
      • Examples
      • Problems
    • for loop - range (two arguments)
      • Problems
    • for loop - range (three arguments)
      • Problems
  • Lists
    • Lists - Numbers
      • Problems
    • Lists - Strings
      • Problems
      • Shopping Project
  • Dictionaries
  • String Methods
  • Functions
    • Variable Scope
    • Functions - no parameters
    • Functions - one parameter
    • Functions - return
    • Functions - lists
  • Files
  • Classes
    • Inheritance
  • Python Projects
    • Adventure Game
    • Restaurant Project
    • Trivia Game
    • Family Tree Project
  • Raspberry Pi
    • Raspberry Pi Models
    • Raspberry Pi Setup
  • Roblox
  • Glossary
Powered by GitBook
On this page
  • Problem 1
  • Sample Output
  • Problem 2
  • Sample Output
  • Problem 3
  • Sample Output
  • Problem 4
  • Sample Output
  • Problem 5
  • Sample Output
  • Problem 6
  • Sample Output
  • Problem 7
  • Sample Output
  • Problem 8
  • Sample Output
  • Problem 9
  • Sample Output
  • Problem 10
  • Sample Output
  • Problem 11 (Challenge)

Was this helpful?

  1. Lists
  2. Lists - Numbers

Problems

PreviousLists - NumbersNextLists - Strings

Last updated 5 years ago

Was this helpful?

Problem 1

Create a list named sales. Use a loop to ask the user to enter a store’s sales for 7 days.

Print the total amount of sales.

Sample Output

Problem 2

Create a list named steps. Use a loop to ask the user to enter the number of steps they walk for 5 days. Print the highest, lowest and average number of steps.

Sample Output

Problem 3

Create a list of 5 numbers that contains positive and negative numbers. Print the list. Delete all of the negative numbers. Print the list again.

Sample Output

Problem 4

Create a list of 5 numbers. Print the list. Sort the numbers. Swap the values of the first and last numbers. Print the list.

Do not hard code the last element with list[4]

Sample Output

Problem 5

Create a list of 5 numbers. Print the list. Print the position of the largest element.

Do not hard code the solution. Your solution should work for any list.

Sample Output

Problem 6

Create a list named grades with 5 grades. Print the list. Print the average of the grades.

Sometimes teachers like to drop a student’s lowest grade. Delete the lowest grade and print the new average.

What's the difference between the new average and the original average?

Sample Output

Problem 7

Create a list of 10 positive and negative numbers. Print the list. Print the sum of the positive numbers and the sum of the negative numbers.

Sample Output

Problem 8

Create a list of 10 positive and negative numbers. Print the number of the positive numbers, number of the negative numbers and the number of 0's.

Sample Output

Problem 9

Create a list of 10 positive and negative numbers. Print the average of the positive numbers and average of the negative numbers.

Sample Output

Problem 10

Create a list of 10 numbers that contains positive and negative numbers. Print the list. Print the number of odd numbers, even numbers and zeros.

0 is an even number

Sample Output

Problem 11 (Challenge)

The interquartile range (IQR) is a measure of variability, based on dividing a data set into quartiles.

Quartiles divide a rank-ordered data set into four equal parts. The values that divide each part are called the first, second, and third quartiles; and they are denoted by Q1, Q2, and Q3, respectively.

Q1 is the "middle" value in the first half of the rank-ordered data set. Q2 is the median value in the set. Q3 is the "middle" value in the second half of the rank-ordered data set. The interquartile range is equal to Q3 minus Q1.

For example, consider the following numbers: 1, 3, 4, 5, 5, 6, 7, 11. Q1 is the middle value in the first half of the data set. Since there are an even number of data points in the first half of the data set, the middle value is the average of the two middle values; that is, Q1 = (3 + 4)/2 or Q1 = 3.5. Q3 is the middle value in the second half of the data set. Again, since the second half of the data set has an even number of observations, the middle value is the average of the two middle values; that is, Q3 = (6 + 7)/2 or Q3 = 6.5. The interquartile range is Q3 minus Q1, so IQR = 6.5 - 3.5 = 3.

Create a list of 10 numbers. Find the IQR. Create a list of 11 numbers. Find the IQR. How do your methods differ.