Hands On Exercise

We'll cover the following

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.

Press + to interact
marks = 90 score in python
print(marks)

Exercise 2

Correct the syntax for the Docstring above the print_score method below.

Press + to interact
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)