Question Detail

COS 102 lecture 4 Objective Question

Question

How can a long Python statement be broken over multiple lines using the preferred style, according to the document?
Options
A By placing a backslash (\) at the end of each line.
B By wrapping the expression inside parentheses, braces, and brackets.
Correct Answer
C By using a semicolon (;) at the end of each partial line.
D By starting each subsequent line with an indentation.
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 22 notes, "To break a long statement over multiple lines, you can wrap the expression inside parentheses, braces, and brackets. This is the preferred style for handling multi-line expressions." The backslash is mentioned as 'Another way'.

Hint

The document specifies a 'preferred style' and an 'another way'.

Question Info