+ 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
2 Answers
+ 3
Python strings are null terminated so it writes each one counting them until the '\0' is found
+ 2
One letter is one byte (including spaces). "Hello world!" is 11 letters plus one space