Question: Exercise 9 . 2 - Smallest value and index Write a function that returns the index of the smallest element ( first occurrance if multiple

Exercise 9.2- Smallest value and index
Write a function that returns the index of the smallest element (first occurrance if multiple) in a list of integers. Write the function using loop without using min function.
In the test program, ask user to enter 10 numbers, save them into a list, print the list, then call the function to display the smallest value and the index.
Sample output:
Enter number: 9
Enter number: 10
Enter number: 7
Enter number: 5
Enter number: 6
Enter number: 7
Enter number: 9
Enter number: 5
Enter number: 8
Enter number: 9
9,10,7,5,6,7,9,5,8,9
The smallest number is: 5
The index of the smallest element is: 3
 Exercise 9.2- Smallest value and index Write a function that returns

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!