Question: In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should

In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all of the numbers in the list that are greater than the number n.

I am writing this program in Python and so far I have this:

#programming exercise 7-6 def main(): #declare local variables. number = 10 num_list = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] #display the number print('Number:', number) #display the list of numbers. print('List of numbers: ', num_list, sep='') #display the list of numbers that are larger #than the number. print('List of numbers that are larger than ', \ number, ':', sep='') #call the display_larger_than_n_list function #passing a number and a number list as arguments. display_larger_than_n_list(number, num_list) #the display_larger_than_n_list function accepts two arguments: #a list, and a number. The function displays all of the numbers #in the list that are greater than the number. def display_larger_than_n_list(n, n_list): #declare an empty list. larger_than_n_list = [] #loop through the value in the list. for value in n_list: #determine if a value is greater than n. I cannot figure out the next line of code and I was hoping to get a solution to the problem with a detailed explanation. Thank you so 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!