CBSE Class 11 Computer Science Question 77 of 173

Data Handling — Question 6

Back to all questions
6
Question

Question 6

What will following code print?

str1 = '''Hell
o'''
str2 = '''Hell\
o'''
print(len(str1) > len(str2))

Answer

This code will print:

True

len(str1) is 6 due to the EOL character. len(str2) is 5 as backslash (\) character is not counted in the length of string. As len(str1) is greater than len(str2) so the output is True.

Answer