Which of the following is the correct syntax for an "if" statement in Python?
Correct!
Wrong!
The correct syntax for an if statement in Python uses a colon (:) to start the block of code that runs if the condition is true.
What does the "return" statement do in a function?
Correct!
Wrong!
The return statement ends the function execution and optionally sends a value back to the function caller.
How do you define a function in Python?
Correct!
Wrong!
In Python, functions are defined using the def keyword followed by the function name and parentheses.
Which keyword is used to exit a loop prematurely in Python?
Correct!
Wrong!
The break keyword is used to exit a loop prematurely in Python. It terminates the current loop and resumes execution at the next statement following the loop.
In Python, what does the "else" block of a "for" loop execute for?
Correct!
Wrong!