All Basic Python exercises with commented solutions. Three difficulty levels per topic — try to solve them yourself before checking the solution. Variables, operators, conditionals, loops and functions.
-
Python functions exercises — consolidate what you know
Python functions exercises with solutions are where everything you’ve learned about functions gets tested for real. You’ve seen the theory and built three complete programs. Now it’s time to solve on your own. In this article you’ll find four exercises across three levels, from a grade converter to a mini bank and a dice game. Each one uses…
-
Python loops exercises — put them to the test
Python loops exercises are where everything clicks. You’ve seen the theory and practised with real programs. Now it’s time to solve on your own. In this article you’ll find four exercises across three levels, from FizzBuzz (a classic that appears in real job interviews) to compound interest and prime numbers. As always: try to solve it, use the…
-
Python conditionals exercises — 4 solved with solutions and cheat sheet
Python conditionals exercises with solutions are the best way to cement if, elif and else. You’ve seen the theory and practised with real programs. Now it’s time to solve on your own. In this article you’ll find four exercises across three levels of difficulty, with special attention to the mistake of confusing and with or — one of…
-
Python operators exercises — 5 solved with solutions and cheat sheet
Python operators exercises with real context are the best way to cement what you learned in theory and practice. In this article you’ll find five exercises across three levels: basic, intermediate and final challenge, with special focus on % and // the operators that confuse the most. As always: try to solve it, use the hint if you’ve…
-
Variables and data types in Python — exercises with solutions and cheat sheet
You’ve seen the theory and practised with real code. Now it’s time for the moment of truth: solving exercises on your own. In this article you’ll find intermediate-level exercises on variables and data types in Python, a final challenge exercise that mixes everything from the topic, and a complete cheat sheet to keep handy. The method is simple:…
