Homework coding challenges

Practise homework with 40 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Easy · 24 Medium · 14 Hard · 2

Skills you'll practise: 2D arraysCase-insensitive comparisonInput validationInteger money mathInteger roundingString building2D boolean grids2D grid traversalAccumulatorsArithmetic expressionsArray scanningBit shifting
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
341
Challenges
241
Solutions shared
9
Languages

All challenges

Search by name or topic, or filter by difficulty.

40 challenges
Easy

Remove Gray From RGB

Remove the gray part of an RGB color by subtracting the smallest channel from all three.

You'll learn Minimum of valuesInput validation
BeginnerBit manipulationCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Tip Calculator

Work out the tip, the total and each person's share of a restaurant bill, all in cents.

You'll learn Integer money mathRounding rules
BeginnerCS1ConditionsFinanceFunctionsHomeworkIntro programmingStacksStudent-beginner
No solutions yet
Medium

Hidden Word Clue

Build the clue for a word guessing game: exact letters, letters in the wrong spot, and misses.

You'll learn String buildingLetter counting
AP Computer ScienceCS1ClassesGamesHomeworkIntermediateIntro programmingOOPStudent-beginner
No solutions yet
Easy

Interstate Highway Numbers

Classify an interstate highway number as a primary or auxiliary route and give its direction.

You'll learn Remainder arithmeticBranching
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Text Message Abbreviations

Expand common texting abbreviations in a message into full words.

You'll learn String splittingLookup tables
BeginnerCS1HomeworkIntro programmingParsingStudent-beginner
No solutions yet
Easy

Season From Month and Day

Given a month name and a day, return the season of the year in the Northern Hemisphere.

You'll learn Chained conditionsInput validation
BeginnerCS1ConditionsDates and timesFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Medium

Spell Checker

List the words in a text that are missing from a dictionary, ignoring case and punctuation.

You'll learn Hash setsTokenizing text
CS1CS50 styleDictionariesHash tablesHomeworkIntermediateIntro programmingStudent-beginner
No solutions yet
Medium

Box Blur

Blur a grayscale image by replacing each pixel with the rounded average of its 3 by 3 neighborhood.

You'll learn Neighborhood loopsBounds checking
CS1CS50 styleGridsHomeworkImage processingIntermediateIntro programmingMatricesStudent-beginner
No solutions yet
Medium

Ticket Lottery Winners

Count how many lottery tickets matched 0, 1, 2, ... of the winning numbers.

You'll learn Set membershipFrequency counts
CS1GamesHomeworkIntermediateIntro programmingStudent-beginner
No solutions yet
Easy

Middle Item

Read numbers up to a negative sentinel and return the middle one.

You'll learn Sentinel valuesList indexing
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Hard

Ranked Pairs Winner

Find the ranked pairs winner of an election by locking head-to-head victories that do not make a cycle.

You'll learn Graph cycle detectionCustom sorting
AdvancedCS1CS50 styleHomeworkIntro programmingSortingStudent-beginnerVoting
No solutions yet
Easy

Shipping Cost Function

Complete the function that prices a package from its weight in ounces and the delivery speed.

You'll learn Ceiling divisionFunction parameters
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Smallest of Three

Return the smallest of three integers.

You'll learn ComparisonsVariables
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Medium

Light Board

Simulate a board of lights where pressing one flips it and its neighbors, and answer count queries.

You'll learn 2D boolean gridsNeighbor offsets
AP Computer ScienceCS1ClassesGridsHomeworkIntermediateIntro programmingMatricesOOPStudent-beginner
No solutions yet
Easy

Caffeine Half-Life

Find how much caffeine is left in the body after a number of hours, given its half-life.

You'll learn ExponentsFloating point math
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Gradebook Letter Counts

Turn a whole class's scores into letter grades and count how many students got each letter.

You'll learn If-else chainsCounting with an array
BeginnerCS1HomeworkIntro programmingStudent-beginner
No solutions yet
Medium

Longest Run of Rolls

Find where the longest run of equal consecutive dice rolls starts and how long it is.

You'll learn Array scanningTracking the best result
AP Computer ScienceCS1ClassesDiceHomeworkIntermediateIntro programmingOOPProbabilityStudent-beginner
No solutions yet
Easy

Contains the Character

Keep only the words that contain a given letter, ignoring case.

You'll learn Case-insensitive comparisonFiltering a list
BeginnerCS1HomeworkIntro programmingStudent-beginner
No solutions yet