Question 15
Back to Exercise
What is the output of the following Python program?
print(len("a\nb"), len(r"a\nb"), "C:\\new".count("\\"), len("\t"))
- A 3 4 1 1 Correct
- B 4 4 2 2
- C 3 3 1 1
- D 4 3 2 1
Correct Answer: Option A
"\n" is one character, but in a raw string it is two (\ and n). "\" is one backslash, so "C:\new" contains one. "\t" is a single tab.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!