Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey can anyone help me with writing this question using python? Ive been working on it for a while now and could really use some

Hey can anyone help me with writing this question using python? Ive been working on it for a while now and could really use some help figuring it out!
image text in transcribed
Question 1 |10 marks Write a function find_valuepos(Alist, base) that returns the position of the smallest value in the list Alist and this smallest value is larger than base. The function will returr -1 if there is no value larger than base. Note, do not sort this list. You should be able to solve this problem going through the list only once. Use this function in a main program as follows. First your main values to a list. For example program should assign L-[4-1, 52, 17, 81,-2, 75, 24] The main program should then print the list. Then the main program should call the above function appropriately in order to print the smallest numbers from the list that are greater than 0, 25, 50, 75 and 100 respectively using the format below. If there is no value larger than one or more of these numbers, then the program will print an appropriate message as indicated below. Remember that the TAs will potentially change the list (and its size) in order to test your program so your program must be general for different list values and sizes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions