2. Question (5 pt.): We have a list variable 'n' which has integer numbers. For each number in the list, find the number

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

2. Question (5 pt.): We have a list variable 'n' which has integer numbers. For each number in the list, find the number

Post by answerhappygod »

2 Question 5 Pt We Have A List Variable N Which Has Integer Numbers For Each Number In The List Find The Number 1
2 Question 5 Pt We Have A List Variable N Which Has Integer Numbers For Each Number In The List Find The Number 1 (35.84 KiB) Viewed 46 times
2. Question (5 pt.): We have a list variable 'n' which has integer numbers. For each number in the list, find the number of smaller numbers in the preceding positions, i.e. if the index of the current elements is i, then preceding elements should have an index less than i. Create the function, i.e., fun_2, to return a list containing for each number in the input list a number of smaller elements in the preceding positions. arg1 = [ 1, 5, 2, 10, 3, 4] output = fun_2(arg1) print(output) [ 0, 1, 1, 3, 2, 3] >>> arg2 = [ 1, 2, 3, 4 ] >>> output = fun_2(arg2) >>>print(output) >>>[0, 1, 2, 3]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply