+ 2

How this code can calculate bytes of a string ?

How the line 3 of this code can calculate bytes of given string ? What is the logic and how ? https://code.sololearn.com/c8tHix009IA0/#py

28th Jan 2018, 8:22 PM
NIMA
NIMA - avatar
2 Answers
+ 3
Python strings are null terminated so it writes each one counting them until the '\0' is found
28th Jan 2018, 8:40 PM
John Wells
John Wells - avatar
+ 2
One letter is one byte (including spaces). "Hello world!" is 11 letters plus one space
28th Jan 2018, 8:39 PM
Toni Isotalo
Toni Isotalo - avatar