+1 vote
Jul 10, 2019 in Python 1,052 views

## 3 answers to this question.

+1 vote

Try this:

```a = [4,7,3,2,5,9]

for i in a:
print("Element: " + str(i) + " Index: "+ str(a.index(i)))```
• 68,860 points
+1 vote
```a = [4,7,3,2,5,9]
b = enumerate(a)
for i in b:
print(i)```
answered Jul 15, 2019 by Kei Tee

edited Jul 22, 2019 by Kalgi
What does the enumerate() function do?
It returns a tuple of  each element and its index, including duplicated elements
+1 vote

Try using this question by list comprehension:

a=[4,7,3,2,5,9]
print([x for x in enumerate(a)])

output:

`[(0, 4), (1, 7), (2, 3), (3, 2), (4, 5), (5, 9)]`
• 160 points
Thanks, @Vinaykumar, that was helpful :)

+1 vote

## I am trying to write a program in python for the occurrences of a character given the start and stop values of that string only using while

Here's the code: check = input("Enter the character: ...READ MORE

## Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

+1 vote

## Data of XYZ company is stored in sorted list. Write a program for searching specific data from that list.

Hello @Ramasubrananiam! You can use the binary ...READ MORE

## How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

## How to count the number of elements in a list?

To count the number of elements of ...READ MORE

## How do I run a set of code for all the requests in Flask?

Hi, You can use dedicated hooks(decorators) called before ...READ MORE

## In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

+1 vote

## Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE