Exercises turn reading into skill. A good exercise asks you to recall the idea, change it, and explain why the result works.
Use this page after reading a lesson or when you need a quick check before moving to the next topic.
Do not copy the solution first. Write a small attempt, run it, read the error, and then compare with the guided answer.
Start with variables, input, output, and conversion. These exercises train the habit of checking value types early.
first = int(input("First number: "))
second = int(input("Second number: "))
print(first + second)
input() returns text, so int() converts each value before addition.
Practice lists, dictionaries, sets, and strings by transforming small data collections.
sentence = "python makes python practice simple"
counts = {}
for word in sentence.split():
counts[word] = counts.get(word, 0) + 1
print(counts)
{'python': 2, 'makes': 1, 'practice': 1, 'simple': 1}
The dictionary stores each word as a key and updates its count each time the word appears.
Function exercises train reusable behavior and clean return values.
Debugging practice is part of learning Python, not a separate skill to postpone.
0 of 2 checked
Try this next
0 of 3 completed
Do at least three: one direct example, one small variation, and one debugging exercise.
No. Memorize the pattern: input, process, output, and how the data changes.
Reduce it to a smaller step, print intermediate values, and compare your code with the closest tutorial example.
Explore 500+ free tutorials across 20+ languages and frameworks.