Python Beginner Exercises with Hints and Solutions

Work through 4 Python practice exercises on dictionaries, list comprehensions, functions and strings. Run each starter in your browser, use hints when needed and compare your result with the complete solution.

You should recognise strings, lists and a basic for loop. The lessons explain dict.get, the remainder operator, sum and len, and the [::-1] slice as they appear.

What you will practise

Work with strings

Lowercase a word and compare it with its reversed slice to find palindromes.

4 exercises to try

How to use these exercises

Predict the output before running each program. Use the hint to get unstuck, then compare your program with the complete solution. Change the input to explore case differences, empty lists and punctuation.

Runtime and progress

Python uses a browser WebAssembly runtime. It does not provide arbitrary operating-system access, unrestricted networking or every pip package.

Completion is self-reported. There is no automated grading, and progress is saved only on this device.

Browse every practice topic