Computer Science
What will following code print?
str1 = '''Hell
o'''
str2 = '''Hell\
o'''
print(len(str1) > len(str2))
Python
Python Data Handling
44 Likes
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.
Answered By
22 Likes
Related Questions
The complex numbers have two parts : real and imaginary. In which data type are real and imaginary parts represented ?
What are Immutable and Mutable types in Python? List immutable and mutable types of Python.
What are three internal key-attributes of a value-variable in Python ? Explain with example.
How many string types does Python support? How are they different from one another?