python counting letters in string without count function

前端 未结 5 1893
眼角桃花
眼角桃花 2021-01-22 16:54

I am trying to write a program to count the occurrences of a specific letter in a string without the count function. I made the string into a list and set a loop to count but th

5条回答
  •  佛祖请我去吃肉
    2021-01-22 17:24

    Be careful, you are using count == count + 1, and you must use count = count + 1

    The operator to attribute a new value is =, the operator == is for compare two values

提交回复
热议问题