Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

looping and counting in python

fruit = 'banana'
count = 0
for letter in fruit:
    if letter == 'a':
        count = count + 1   # We can write this as (count += 1)
print(count)
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #looping #counting #python
ADD COMMENT
Topic
Name
6+6 =