Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started