Question: Activity 3 Write a Python program that accepts an array from the user and finds out how many numbers are smaller than the current number.

Activity 3

Write a Python program that accepts an array from the user and finds out how many numbers are smaller than the current number. Please write a method which takes input either an array/ list. Please note: The elements of the array must be taken from the user during runtime

Sample output

nums = [8,1,2,2,3]

Output: [4,0,1,1,3]

Explanation:

For nums[0]=8 there exist four smaller numbers than it (1, 2, 2 and 3).

For nums[1]=1 no smaller number than 1.

For nums[2]=2 there exist one smaller number than it (1).

For nums[3]=2 there exist one smaller number than it (1).

For nums[4]=3 there exist three smaller numbers than it (1, 2 and 2).

Points Division Code =40 points ; Comments = 10 points

(Please help me explain so I can learn! Thank you very much!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!