Missing parentheses #
In Python, parentheses are used to enclose arguments in function calls, define tuples, and group expressions. Forgetting to include or properly close parentheses can lead to syntax errors in your code. It's important to understand where parentheses are required and ensure they are used correctly to avoid such errors.
For example, if we run this code below in our editor:
print("Hello World"
The output of the program will be an error type SyntaxError, which tells us that there is something wrong with the syntax.
# Output:
File "main.py", line 1
print("Hello World"
^
SyntaxError: '(' was never closed
Exercise #
- Fix the code by adding the necessary parentheses to resolve the syntax error.
Tests #
- The program should run without an error
- The program should print the message
"Hello World!"
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules