Question Detail

COS 102 Python strings Objective Question

Question

Which of the following Python string creations would result in an error based on the rules mentioned in the document?
Options
A 'Hello'
B "Python"
C """Multi-line"""
D 'Mixed"quotes'
Correct Answer
Correct Answer

Option D is the correct answer.

Detailed Explanation

Page 4 states, 'Note: Quotes must match at the beginning and end!' Option D uses a single quote to start and a double quote to end, which is a mismatch and would cause a SyntaxError.

Hint

Pay close attention to the opening and closing quotation marks for each option.

Question Info