Computers and Technology

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()

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:30, alexandramendez0616
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, studybug2306
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
image
Computers and Technology, 23.06.2019 09:30, jason9394
Facial expressions and gestures are examples of messages.
Answers: 3
Do you know the correct 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
Mathematics, 02.12.2020 20:40
Konu
Mathematics, 02.12.2020 20:40