Question

Question 5 4 pts The formula to find the index of the middle element of a list is HTML Editore BI VAAI E XX, ON V GV DITT 10p
0 0
Add a comment Improve this question Transcribed image text
Answer #1

def findMiddleElement(list):
middle = float(len(list))/2
if middle % 2 != 0:
return list[int(middle - .5)]
else:
return (list[int(middle)], list[int(middle-1)])

if the list is od then it will print the middle print.

if the list is even then it will give two middle element.

Add a comment
Know the answer?
Add Answer to:
Question 5 4 pts The formula to find the index of the middle element of a...
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