I think you have a simple, one-line change.
You get the name instead of the index, because that’s exactly what you told it to print. Instead, use this:
print('The index of this name is ', index)
Your original went to the extra trouble to look up the name in that location.
More Related Contents:
- Accepting only letters as input [closed]
- How can I represent an ‘Enum’ in Python?
- Faster version of ‘pygame.event.get()’. Why are events being missed and why are the events delayed?
- Concatenate strings from several rows using Pandas groupby
- Python : no module named selenium
- How to use pip with Python 3.x alongside Python 2.x
- Moving Average Pandas
- How can I periodically execute a function with asyncio?
- TypeError: worker() takes 0 positional arguments but 1 was given [duplicate]
- Python 3.7 – asyncio.sleep() and time.sleep()
- How to run pip from different versions of python using the python command?
- SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//img[contains(‘1236548597′)]’ is not a valid XPath expression
- CSS not loading wrong MIME type Django [duplicate]
- What is “pkg-resources==0.0.0” in output of pip freeze command
- What is the fastest and most efficient way to append rows to a DataFrame?
- How to share numpy random state of a parent process with child processes?
- What is a “callable” in Python?
- How can I print multiple things (fixed text and/or variable values) on the same line, all at once?
- Why am I getting “invalid syntax” from an f-string? [duplicate]
- Check if rows in one dataframe exist in another dataframe
- Python: can’t assign to literal
- How to change the voice in pyttsx3?
- How to reuse an expression in a comprehension expression?
- How to move the background image with keys in pygame?
- Customize argparse help message
- What is the recommended way to break a long if statement? (W504 line break after binary operator)
- How do I call a method from another method?
- Why do I get “TypeError: not all arguments converted during string formatting” trying to substitute a placeholder like {0} using %?
- What are assignment expressions (using the “walrus” or “:=” operator)? Why was this syntax added?
- TypeError: cannot unpack non-iterable NoneType object