Hi guys could someone help me with this. I try to write a loop to get a list of number of word "END"
CodePudding user response:
You don't need to return it, if you just want to see the value of count_end you can add print(count_end)
and that will output your list.
Also, for loops in python will automatically add 1 to the variable you specified, so if you want to iterate over every element in that list you don't need the line i =1
Final one, for i in range(x)
will automatically stop at x-1, i.e. for i in range(3)
goes through 0,1,2. No need for the extra -1.