Data Types
Hands On Exercise
- Beginner
- January 7, 2026
Practice identifying and correcting syntax errors in Python comments and docstrings. This lesson helps you apply knowledge to enhance code readability and maintainability by working through practical coding exercises.
Congratulations on completing the lesson on Python comments. Test your knowledge through these short snippets and get one step closer to mastering Python!
Exercise 1
The code below is incorrect and results in an error. Spot the inline comment and correct the code so that it can be executed without errors.
marks = 90 score in python
print(marks)
Exercise 2
Correct the syntax for the Docstring above the print_score method below.
print_score is a function that takes a single parameter my_score and prints it to the console.
A score of 80 is defined for Algebra and the print_score function is called.
def print_score(my_score):
print(f"Score = {my_score}")
algebra_score = 80
print_score(algebra_score)
On this page
In This Module