Back to curriculum

Week 3

Week 3: Functions, Dictionaries, and Data

Combine functions with dictionaries, counting, lookups, and data patterns used in PCEP and beginner contest practice.

Log in to track progress on the assigned problems.

Week 3: Functions, Dictionaries, and Data

Students learn to organize code with functions and solve data-focused problems with counting, dictionaries, and prefix sums.

Topics

  • functions, parameters, and return values
  • decomposition
  • dictionaries and frequency counting
  • lookups
  • prefix sums

Required Problems

  • Practice Groups
  • Completed Modules
  • Project Tags
  • Word Frequency
  • Prefix Sum Queries

Lesson completion is automatic. Students complete the week when every required problem has an accepted submission.

Required practice

Problems for this lesson

Solve all assigned problems to complete the week.

1FunctionsIntermediate

Practice Groups

Each mentor group can hold `k` students. Given `n` students, print the minimum number of groups needed.

Open problem
2LoopsBeginner

Completed Modules

A student earns points for each completed module. Given `n` point values, compute the total.

Open problem
3DictionariesIntermediate

Project Tags

Given `n` project tags and one target tag, count how many times the target appears.

Open problem
4DictionariesBeginner

Word Frequency

Count how many times a target word appears in a sentence.

Open problem
5Prefix SumsIntermediate

Prefix Sum Queries

Answer range sum queries on a list using 1-based inclusive indexes.

Open problem