Project: Overview
- Algorithms course
- Beginner
- Lesson 17/80
- 4 min
Plan a mini app that searches a grades array.
Project: Note search
In this project you will build a note-searching application. You will first define the note array, then add a search function.
Each lesson builds on the previous one: your code grows each step and you end up with a working search tool.
Note array
We will store five students' notes in an array: [85, 90, 78, 92, 88]. This array is the basis for all searches.
By returning the array from a function, we make it accessible everywhere. This makes the code reusable.
Practice Define note array
Write init_notes(). Return the array [85, 90, 78, 92, 88]. Print it with print(init_notes()).
Starter code
def init_notes():
# Return note arraySample solution
def init_notes():
# Return note array
return [85, 90, 78, 92, 88]
print(init_notes())Expected output
[85, 90, 78, 92, 88]
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Project: Overview: match the terms
| Term | Meaning |
|---|---|
init_notes |
Define array |
find_note |
Search |
report_result |
|
find_all |
Find all |
2 What is the first step of the project?
- Find all
- Define note array
- Print result
- Search function Correct answer
Explanation: The first step is to define the note array.
3 Array definition
The note array is ____.
The note array is [85, 90, 78, 92, 88].
Explanation: [85, 90, 78, 92, 88] is right.