Light Mode
Dark Mode
result difference between len() and count()

hi everybody, I could not understand why python return different result in len and count founctions? For example, result of below listed two functions will be :

a = 'hello' len(a) 5 a.count('') 6

Could you please explain this, why count add one to the result?

Thanks in advance, Shahin

Created: Dec. 30, 2015, 7:31 a.m.
Updated: Dec. 31, 2015, 8:01 a.m.
0
9
User avatar
Shiko