0
nums = [1, 3, 5, 2, 4] print(len('string'))
Why the output is 6?
6 odpowiedzi
+ 11
you have list with 5 elements in it!.But,you printed length of the String 'string' ('string' has 6 characters so len('string') gives 6 has the output
+ 3
How many letters are in string?😉
+ 3
🤗🤗🤗 are you printing string or the given array.... In this case the latter is used 🌅
+ 2
Try print(len(nums)) instead
+ 2
This is bcoz strings have a '\0' character, so it gives you 6, included \0 this.
+ 1
Because it calcualating the charachters of string like s-1
t-2 r-3 i -4 n-5 g-6 so total length is 6