Question: python Create a list with the following data 1, 3, 5, 9, 7, 8, 2, 6, 3, 11 (a) Complete your program so that it
Create a list with the following data 1, 3, 5, 9, 7, 8, 2, 6, 3, 11 (a) Complete your program so that it accepts an integer i and returns the ith element of the array. Your program should also check the validity of the input. The sample inputs and outputs are listed below: Input Output 7 Case 1 2 3 4 5 3 7 2. 3 5 5 2 Error: Invalid Input 0 (b) Modify your program so that it accepts an integer i and returns the index of the first element with value equal to i. If no match element, output -1. The sample inputs and outputs are listed below: Case Input Output 1 5 2. 2 3 1 3 4 4 4 -1 2. 3 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
