Problem 6 of 50

Easy

What to do

Given a list of age limits for horse races and a horse's age `k`, count how many races the horse can enter. A horse can enter a race if its age is less than or equal to the race's age limit (k <= ages[i]).

Key Concepts

lists loops conditional statements input/output

Examples

Input: ages = [3, 1, 4, 1, 5], k = 4

Output: 2

Input: ages = [1], k = 100

Output: 0

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...