Count down from n
Implement a function that returns a list from n down to 1.
Multiplication Table Row
Return the nth row of a multiplication table as a list of 1..n products.
Last Occurrence of a Value
Implement a function that returns the last index of a given value in a list, or -1 if it's not present.
Cycle a List Once
Implement a function that rotates a list right by one position.
Boolean Mask Filter
Write a function that filters a list based on a boolean mask and returns the selected elements.
Replace negatives with zero
Implement a function that replaces all negative numbers in a list with zero.
Average of a list
Write a function that computes the average of a list of numbers, handling empty lists by returning 0.
Map, Filter, Reduce
Implement three functions using map, filter, and reduce to manipulate a list of integers.
Count Leading Zeros
Write a function that returns the number of leading zeros in a list of integers.
Showing 9 challenges · Python Basics
Python Basics — Python coding challenges
What you will find here
This page lists python basics challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.