Question

In python

Write a function named printList to print the elements of a list with labels showing each elements order in the list. The function header should like this: def print List (aList) And here is an example run myList [92.5 127.1 9, 104.2, 78.41 print List (myList) 0 92.5 1 127.1 3 104.2 4 78.4 Test your function from the Python Shell window on various types of lists with varying lengths.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

def printList( mylist ):
for l in mylist:
print("%d %d" % (mylist.index(l),l))
return

mylist = [10,20,30];
printList( mylist );

Output:

Add a comment
Know the answer?
Add Answer to:
In python Write a function named printList to print the elements of a list with labels...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT