Vidyalelo
Python · Q28

Python Introduction and basic

Programming · Python · question 28

Q28

What is the output of print("Hello, " + "world!")?

A.
Hello, world!
Answer
B.
Hello world!
C.
Hello + world!
D.
Error

Answer: Option A

Solution

Answer: Option A
Solution:
The output of print("Hello, " + "world!") is Hello, world!.
The print() function in Python is used to output text to the console. In this case, the function prints the concatenated string "Hello, " followed by "world!" resulting in "Hello, world!" being displayed on the console. The plus (+) operator is used for string concatenation, which combines the two strings into a single string. Therefore, the correct output is "Hello, world!".