0
Why the output of this code is 5
S = 'A\nB\tC' Print(len(s))
2 Réponses
+ 2
You have 5 characters in your string, and hence a length of 5.
Character 'A', '\n' (newline), 'B', '\t' (horizontal tab), 'C'.
0
No idea about python. 😬
I think you are trying to find the length of a string.
In C language string must be in double quotes " ", so S = "ABC" while initialising the variable we don't use escape sequence.
Your code will be like this in C Language.
char S = "ABC";
Printf("%d", strlen(S));
return 0;
Output : 3
Edit: - you are getting correct output. whatever you will write within the double quotes it will be a character that's why you are getting 5 as a output.