Learning Python is hands-on. You cannot learn it by just watching tutorials — you need to write code. These 10 exercises are designed for absolute beginners. Each exercise comes with a detailed solution and explanation. No sign-up, no paywall. Just practice. All exercises tested with Python 3.8 through 3.13.

If you can solve all 10, you have a solid foundation in Python basics.

Exercise 1: Hello, Variables!

Task: Create three variables — a string, an integer, and a float — and print them all on one line.

# Solution
name = "Alice"
age = 25
height = 1.68  # meters

print(f"{name} is {age} years old and {height}m tall")

What you learn: Variable assignment, data types, f-strings.

Exercise 2: The Friendly Greeter

Task: Write a function that takes a name as input and returns a greeting. Then ask the user for their name and greet them.

# Solution
def greet(name):
    return f"Hello, {name}! Welcome to Python."

user_name = input("What is your name? ")
print(greet(user_name))

What you learn: Defining functions, user input, string formatting.

Exercise 3: Even or Odd

Task: Write a function that tells you whether a number is even or odd. Test it with numbers 1 through 10.

# Solution
def even_or_odd(number):
    if number % 2 == 0:
        return "even"
    return "odd"

for i in range(1, 11):
    print(f"{i} is {even_or_odd(i)}")

What you learn: Conditionals, modulo operator, for loops.

Exercise 4: Sum of a List

Task: Given a list of numbers, write a function that returns the sum. Do not use the built-in sum() function — write the loop yourself.

# Solution
def manual_sum(numbers):
    total = 0
    for num in numbers:
        total += num
    return total

my_numbers = [4, 8, 15, 16, 23, 42]
print(manual_sum(my_numbers))  # 108

What you learn: Iterating over lists, accumulation pattern.

Exercise 5: Count the Vowels

Task: Write a function that counts how many vowels (a, e, i, o, u) are in a given string. Ignore case.

# Solution
def count_vowels(text):
    vowels = "aeiou"
    count = 0
    for char in text.lower():
        if char in vowels:
            count += 1
    return count

print(count_vowels("Hello World"))  # 3
print(count_vowels("Python is fun"))  # 4

What you learn: String methods, membership testing.

Exercise 6: Reverse a String

Task: Write a function that takes a string and returns it reversed. Then reverse "Python is awesome!"

# Solution (Pythonic way)
def reverse_string(text):
    return text[::-1]

# Solution (manual way)
def reverse_string_manual(text):
    result = ""
    for char in text:
        result = char + result
    return result

print(reverse_string("Python is awesome!"))

What you learn: String slicing, the [::-1] trick.

Exercise 7: Find the Largest Number

Task: Without using max(), write a function that finds the largest number in a list.

# Solution
def find_largest(numbers):
    if not numbers:
        return None
    largest = numbers[0]
    for num in numbers:
        if num > largest:
            largest = num
    return largest

print(find_largest([3, 7, 2, 9, 1]))  # 9

What you learn: Edge case handling (empty list), comparison logic.

Exercise 8: FizzBuzz

Task: The classic. Print numbers 1 through 20. For multiples of 3, print "Fizz". For multiples of 5, print "Buzz". For both, print "FizzBuzz".

# Solution
for i in range(1, 21):
    if i % 3 == 0 and i % 5 == 0:
        print("FizzBuzz")
    elif i % 3 == 0:
        print("Fizz")
    elif i % 5 == 0:
        print("Buzz")
    else:
        print(i)

What you learn: Multi-condition logic, order of conditions matters.

Exercise 9: Word Frequency Counter

Task: Given a sentence, count how many times each word appears. Print the results sorted by frequency.

# Solution
from collections import Counter

sentence = "the quick brown fox jumps over the lazy dog the dog barks"
words = sentence.lower().split()
word_counts = Counter(words)

for word, count in word_counts.most_common():
    print(f"{word}: {count}")

What you learn: The collections.Counter utility, splitting strings.

Exercise 10: Simple To-Do List

Task: Build a command-line to-do list. The user can add, view, and remove tasks. Store the tasks in a list. Exit when the user types "quit".

# Solution
tasks = []

while True:
    print("\n--- To-Do List ---")
    print("1. Add task")
    print("2. View tasks")
    print("3. Remove task")
    print("4. Quit")

    choice = input("Choose an option: ")

    if choice == "1":
        task = input("Enter task: ")
        tasks.append(task)
        print(f"'{task}' added!")

    elif choice == "2":
        if not tasks:
            print("No tasks yet!")
        else:
            for i, task in enumerate(tasks, 1):
                print(f"{i}. {task}")

    elif choice == "3":
        if not tasks:
            print("No tasks to remove!")
        else:
            for i, task in enumerate(tasks, 1):
                print(f"{i}. {task}")
            index = int(input("Number of task to remove: ")) - 1
            if 0 <= index < len(tasks):
                removed = tasks.pop(index)
                print(f"'{removed}' removed!")
            else:
                print("Invalid number!")

    elif choice == "4":
        print("Goodbye!")
        break

    else:
        print("Invalid choice. Try again.")

What you learn: While loops, user interaction, list operations (append, pop, enumerate).

What to Do Next

If you solved all 10 exercises, congratulations! You now understand variables, functions, conditionals, loops, strings, lists, and user input — the building blocks of every Python program.

Your next step: combine multiple concepts. Try building a quiz game, a budget tracker, or a simple calculator. Each project forces you to think about structure, not just syntax.

Frequently Asked Questions

How long does it take to learn Python with these exercises?

If you are consistent, solving these 10 exercises can take 3-5 hours for a complete beginner. The real learning happens when you modify the exercises — change requirements and see if your code still works.

What Python version do I need?

All exercises work with Python 3.8+. Download the latest version from python.org.