The str.find
finds the index of the item. You need to use str.count
.
def ex4(str4):
someLetter = str4[ :1]
return str4.count(someLetter)
print ex4("mldtmgm")
More Related Contents:
- a python library that accepts some text, and replaces phone numbers, names, and so on with tokens
- How to save and load cookies using Python + Selenium WebDriver
- Using quotation marks inside quotation marks
- Local variable referenced before assignment?
- Changing an element in one list changes multiple lists [duplicate]
- Tkinter vanishing PhotoImage issue [duplicate]
- Script using multiprocessing module does not terminate
- Numpy – create matrix with rows of vector
- Modules are installed using pip on OSX but not found when importing
- How to use append with pickle in python?
- Argparse with required subparser
- portable way to write csv file in python 2 or python 3
- Run a foreign exe inside a Python GUI (PyQt)
- Decompile Python 2.7 .pyc [closed]
- How to call Base Class’s __init__ method from the child class? [duplicate]
- How to set justification on Tkinter Text box
- ‘^’ is ignored by Python – how to escape ‘^’ character in Popen Windows?
- Why is the time complexity of Python’s list.append() method O(1)?
- How should I understand the output of dis.dis?
- Using PIL to turn a RGB image into a pure black and white image
- Can json.loads ignore trailing commas?
- Opencv – Grayscale mode Vs gray color conversion
- Sending a file over TCP sockets in Python
- How to make a simple multithreaded socket server in Python that remembers clients
- Calling Python script from C++ and using its output
- Python 2: SMTPServerDisconnected: Connection unexpectedly closed
- Redo for loop iteration in Python
- Pycharm environment different than command line
- Merge xml files with nested elements without external libraries
- subprocess.Popen in different console