Leap Year Checker
Implement a function that returns True if a year is a leap year according to the Gregorian calendar rules.
Absolute Difference
Implement a function that returns the absolute difference between two numbers.
Max of three numbers
Implement a function that returns the maximum of three numbers using comparisons.
Sign of a number
Write a function sign_of_number that returns -1 for negatives, 0 for zero, and 1 for positives.
Countdown printer
Implement a function that prints a countdown from a given number down to 1, then returns 'Go!'.
Sum from 1 to n
Write a function that returns the sum of all integers from 1 to n (inclusive).
Average of a list
Write a function that computes the average of a list of numbers, handling empty lists by returning 0.
Find Minimum Value
Write a function that returns the minimum integer from a given list.
Range of values
Calculate the range (max minus min) of a list of numbers. Empty list returns 0.
Is divisible by?
Create a function that returns True if a is divisible by b with no remainder, with a clear definition of edge cases.
Area of Rectangle
Write a function that returns the area of a rectangle given its width and height.
Perimeter of triangle
Given three side lengths, return the perimeter (sum) of the triangle.
Volume of Cube
Write a Python function that returns the volume of a cube given its side length.
Modulo Remainder
Implement a function that returns the remainder of a divided by b without using the modulo operator.
Print Pyramid Pattern
Implement a function that returns a centered asterisk pyramid as a list of strings.
Last Digit Extractor
Write a function that returns the last digit of a non-negative integer using the modulo operator.
Count word occurrences
Write a function that takes a sentence and returns a dictionary of word counts.
Find Missing Number
Given a list of n distinct integers from 0..n with one missing, return the missing number.
Linear Search Implementation
Implement a linear search function that returns the index of the first occurrence of a target in a list, or -1 if not found.
Validate date format
Return True if input string is exactly YYYY-MM-DD and a real calendar date.
Count Leading Zeros
Write a function that returns the number of leading zeros in a list of integers.
Remove Duplicates from Sorted Array
Given a sorted list, remove duplicates in-place and return the new length.
Longest Substring with K Repeating Characters
Return the length of the longest substring of a given string in which every character appears at least K times.
Copy deep vs shallow
Predict and write a function that returns a copied list and inspect whether nested modification affects the original.
Showing 25–48 of 62 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.