Skip to main content
Python Bug Hunt Easy +10 XP

Indentation Error

This function has a bug preventing it from running.

PythonFind the bug
1def greet(name):
2return f"Hello, {name}"
The bug is on line 2

Select the correct fix

Show answer and explanation

Answer: Add 4 spaces before return

Python requires indentation for code blocks. The return statement must be indented inside the function.

Hint: Python uses whitespace for structure.

What this challenge tests

Bug Hunt in Python: indentation, syntax.

Related challenges