In: Computer Science
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.
The program should ask for a list of numbers from the user as well as a value (a, b, c)--> inputs from user. After that, each number in that list should be compared to that value (a or b or c).
#source code in python:
def datafun(lst,nval):
out=[]
for i in lst:
if i>nval:
out.append(i)
return out
if __name__=="__main__":
sub=[]
n=int(input("Enter length of list:"))
v=int(input("Enter value:"))
for i in range(n):
val=int(input("Enter the element:"))
sub.append(val)
print("The Created list:",sub)
print("The value:",v)
out=datafun(sub,v)
print("The output list:",out)
#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks.