CodeBlanks Logo Icon CodeBlanks

Project: Overview

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

solution.py
def init_notes():
    # Return note array

Sample solution

solution.py
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 Print
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

Question
The note array is ____.
Answer
The note array is [85, 90, 78, 92, 88].

Explanation: [85, 90, 78, 92, 88] is right.

All lessons in Beginner