Question Detail

COS 102 lecture 4 Objective Question

Question

When using the print statement to combine both text and a variable in Python, which character is primarily used for this purpose?
Options
A The ampersand (&)
B The plus (+)
Correct Answer
C The comma (,)
D The underscore (_)
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 33 states, "To combine both text and a variable, Python uses the + character: Example x = 'awesome' print ('Python is ' + x)"

Hint

Refer to the examples provided for outputting variables combined with text.

Question Info