Fall 2024 - P5
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.10.3 Python Hacks - Period 4
This is student-led teaching on lists! Here you'll learn how to manipulate individual elements or items in a list using indexing.
Setup
- Create a New Jupyter Notebook: Open Jupyter Notebook and create a new notebook with a Python kernel.
- Set the Cell Language: Ensure that the language of the code cell is set to Python.
- Start Coding: You can now begin writing your Python code and execute it using the Jupyter Notebook interface.
Problem #1 -
Objective: Create a simple program to manage a grocery list.
Requirements:
- Create an empty list to store grocery items.
- Input three grocery items and add them to the list.
- Display the current grocery list after all items are added.
- Sort the list alphabetically and print the sorted list.
- Remove one item specified by them and display the updated list.
Problem #2 -
Filtering Even Numbers Objective: Create a list of numbers and filter for even numbers.
Requirements:
- Create a list of integers from 1 to 20.
- Print the original list.
- Create a new list that contains only the even numbers from the original list using list comprehension.
- Print the list of even numbers.
Problem #3 -
Write a program that manages a list of student grades.
Requirements:
- Create an empty list to store student grades.
- Input three grades (as integers) and add them to the list.
- Print the list of grades after all grades are entered.
- Create a new list that contains only grades above 60 and print this list.
Problem #4 -
Number List Operations Objective: Create a list of numbers and perform basic operations.
Requirements:
- Create a list of numbers from 1 to 10 (integers).
- Print the original list.
- Sort the list in descending order.
- Slice the list to get the first five numbers and print them.
- Sort the list again at the end in ascending order and print it.
Homework scaling
0 = .00 work, but faking understanding/accomplishment
1 = .55 incomplete assignment, big gaps
2 = .75 meeting some objectives, multiple little gaps
3 = .85 meeting most objectives, one little gap
4 = .90 meeting all objectives
4+= .95 utilizes all the popcorn hacks, and does all the hacks correctly (if not better).