Question

Write a program that creates a list of 20 integers (between 1 and 40) using a...

Write a program that creates a list of 20 integers (between 1 and 40) using a random number generator function. Write a function that returns the index (position) of the third largest element from the list of integers. If there are more than one third largest number, return the index of the first occurrence of that number.
Eg: Assume that your main function has created the following list of integers generated from the random number function.
[12, 30, 28, 4, 17, 21, 5, 3, 35, 33, 23, 25, 21, 14, 14, 33, 16, 38, 13, 29]
Expected output:
List of integers:
[12, 30, 28, 4, 17, 21, 5, 3, 35, 33, 23, 25, 21, 14, 14, 33, 16, 38, 13, 29]
Third largest number: 33
Index (position) of third largest number: 10

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Write a program that creates a list of 20 integers (between 1 and 40) using 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
ADVERTISEMENT