
6-4
By:
Mars83 on
Oct 9th, 2011 | syntax:
Python | size: 0.42 KB | hits: 46 | expires: Never
#! /usr/bin/env python3.2
# -*- coding: utf-8 -*-
# main.py
""" Task: Exercise 6.4
There is a string method called count that is similar to the function in
the previous exercise. Read the documentation of this method at
docs.python.org/library/string.html and write an invocation that counts the
number of times the letter a occurs in 'banana'.
"""
''' Main '''
word = 'banana'
print(word.count('a'))