Python Programming - Tricky Questions - Discussion

Discussion Forum : Tricky Questions - General Questions (Q.No. 35)
35.
What will be the output of the following Python code?
string1 = "Python"
string2 = string1
string2 += " is great"
result = string1 + string2
print(result)
"Python is greatPython is great"
"PythonPython is great"
"Python is great is great"
This code will result in an error.
Answer: Option
Explanation:
Immutable strings, when concatenated, create a new string.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.