Question: Exercise 9 . 2 - Smallest value and index Write a function that returns the index of the smallest element ( first occurrance if multiple
Exercise 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 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:
Enter number:
Enter number:
Enter number:
Enter number:
Enter number:
Enter number:
Enter number:
Enter number:
Enter number:
The smallest number is:
The index of the smallest element is:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
