- 1

What should be the length of 'first' in python?

I tried in vscode it gives result 4. It should have been 5.

29th Dec 2019, 10:48 PM
Amit Singh
Amit Singh - avatar
5 Respostas
+ 5
The string 'first' is definitely length 5. But the letters are counted 0, 1, 2, 3, 4. Can you show us what exactly you did?
29th Dec 2019, 10:56 PM
HonFu
HonFu - avatar
+ 3
I fixed it up to where I believe yoy wanted it to be. It prints 5 6. not 4 7 https://code.sololearn.com/cn8kFKO1ZCr9/?ref=app
30th Dec 2019, 12:55 AM
Jax
Jax - avatar
+ 2
Amit Singh That's quite unclear, could you write it without errors?
30th Dec 2019, 12:05 AM
Seb TheS
Seb TheS - avatar
+ 1
Yeah that's correct. Thank you Jax
30th Dec 2019, 10:21 PM
Amit Singh
Amit Singh - avatar
0
Course = f"(len (first) (2 + 4)) print (course) Output 4 7 course is in lower case. first is in curly braces. 2+4 is in curly braces
29th Dec 2019, 11:41 PM
Amit Singh
Amit Singh - avatar