Question: Write a program to calculate the second smallest number in an arbitrary list. For example, if the list is x = [1,2,3,10,23], then the output
- Write a program to calculate the second smallest number in an arbitrary list. For example, if the list is x = [1,2,3,10,23], then the output should be 2. There are many ways to do it, you will receive full marks as long as the program works.
- Following the previous question, now define a function that takes a list x and an integer n as inputs, and then return the n-th smallest number in list x. For example, if x=[1,2,3,10,23], and n = 4, then func(x,n)=10 because 10 is the 4th smallest number in x.
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
