subject

In python, in a program write a function that accepts two arguments: a list, an 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. here is what i have so far.

#call the main function
def main:
#declares local variables
number = 5
number_list = [1,2,3,4,5,6,7,8,9,10]
#displays the number
print('number', number)
#displays the list of numbers
print('list of numbers: /n', number_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 larger_than_n_list function,
#passing a number and number list as arguments.
display_larger)than_n_list(number, number_list)
# the display_largger_than_n_list function acceps two arguments:
#a list, and a number. the function displays all of the numbers
#in the list that are greater than that number.
def display_larger_than_n_list(n, n_list):
#declare an empty list
larger_than_n_list = []
#loop through the values in the list.
for valie in n_list:
#determins if a value is greatter than n.
dont know what goes here
#if so, append the value to the list
larger_than_n_list. append(value)
#display the list.
print("larger_than_n_list")
#call the main function
main()

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:00, noeminm105
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag. e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
image
Computers and Technology, 23.06.2019 02:30, chaaaa
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, cheycheybabygirl01
How can the temperature of a room be raised by 5degreesf?
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, janeliles
Why would a business likely use a java applet - to back up their data files for the business - to create a program that a customer can launch in their web browser - to create music on a powerpoint presentation - to organize files on their company directory
Answers: 3
You know the right answer?
In python, in a program write a function that accepts two arguments: a list, an a number n. assume...

Questions in other subjects:

Konu
Social Studies, 10.01.2022 02:50
Konu
Mathematics, 10.01.2022 02:50
Konu
English, 10.01.2022 03:00
Konu
Mathematics, 10.01.2022 03:00