0

Simple python program

def length(string): cnt=0 for i in string: cnt+=1 print(cnt) print("enter string") string=input() print(length(string)) In the above code I am getting the output as: enter string Jesha 5 None Can anyone please explain me why NOne is getting printed????

13th Oct 2018, 5:16 PM
Jesha Rose George
Jesha Rose George - avatar
1 Odpowiedź
+ 1
Hey I got the answer I didnt include return statement at the end of function...
13th Oct 2018, 5:19 PM
Jesha Rose George
Jesha Rose George - avatar