Q. Which statement is used to define a block of code that runs only when the program is executed directly, not when imported?
β
Correct Answer: (B)
if __name__ == '__main__':
Explanation: The `if __name__ == '__main__':` block ensures the code runs only when the file is executed directly.