Exam GPYC All QuestionsBrowse all questions from this exam
Question 14

What is the output of the following command typed in Python interactive mode?

>>> print(`and` in `And now for something completely different`)

    Correct Answer: A

    The command uses backticks (`) around the string instead of single or double quotes, which causes a syntax error in Python. The correct syntax should involve using either single (' ') or double (' ') quotes for string literals.

Discussion
AZIrvThoOption: A

When I run this code: print('and' in `And now for something completely different`) I get a syntax error: print('and' in `And now for something completely different`) ^ SyntaxError: invalid syntax

ootesttakeroo

can someone explain?

GJBBOption: C

The code has the wrong quotes on examtopics, if you type: print('and' in 'And now for something completely different') it returns false