1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Studentka2010 [4]
3 years ago
10

The function below takes one parameter: a list of numbers (num_list). Complete the function to return a new list containing only

the negative numbers from the original list. For this question, you'll first want to create an empty list. Then, you'll want to visit every element of the original list checking to see if it is negative. For the negative elements, you'll append them to your new list. Finally, return the new list.
Computers and Technology
1 answer:
agasfer [191]3 years ago
6 0

Answer:

Following are the program in the Python Programming language.

#define function

def negative_num(num_list):

 #set list type variable

 nlist=[]

 #set the for loop

 for n in num_list:

   #check negative numbers

   if(n<0):

     #add the value of n in list

     nlist.append(n)

 #return list

 return nlist

#set new list type variable that store list

newl=[-5,8,-6,3,-4,9,-7]

#print and call the function

print(negative_num(newl))

<u>Output</u>:

[-5, -6, -4, -7]

Explanation:

Here, we define the function "negative_num" and pass an argument "num_list" in its parameter and inside the function.

  • Set new list data type variable "nlist".
  • Set the for loop which iterate as the list.
  • Set the if conditional statement to check the value of the list is less than 0 then, add that negative values in the variable "nlist".
  • Then, return the new list.

Finally, we set a variable "newl" which store the list of negative and positive numbers then, we print and call the function.

You might be interested in
What are the two ways to print a document?
guajiro [1.7K]

Answer:

ctrl+p or find the print button on the page

5 0
3 years ago
Materials such as copper, silver, and aluminum through which electric energy passes freely are called
nasty-shy [4]
These materials are called conductors
6 0
3 years ago
The Align Center option in the Alignment grouping on the Table Tools Layout tab will _____.
AnnyKZ [126]

the awnser would be d center the text vertically and horrizontaly in the cell

6 0
2 years ago
Read 2 more answers
What protein is found in hair and nails
Yuliya22 [10]

Keratin is found in both hair and nails.

Hope this helps!

4 0
3 years ago
Read 2 more answers
Luke recently purchased a used computer from a friend. His friend said that the computer’s hardware worked well, but occasionall
amid [387]

depending on the age and other things about the computer. check all of them.

3 0
3 years ago
Read 2 more answers
Other questions:
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    8·1 answer
  • What was the first browser that allowed for graphics to be viewed on the web?
    14·2 answers
  • If you have cable internet service, what protocol is used between the head end connection and the cable company's network
    8·1 answer
  • True or false: a cover letter accompanies a resume to showcase a job-seeker’s personal life
    6·2 answers
  • During which phase of film making does the team outline their vision for the film?
    5·1 answer
  • What feature sets Macs apart from other operating systems?
    5·1 answer
  • Can a idler gear increase or decrease torque?
    7·1 answer
  • A host is on the 192.168.146.0 network that has a subnet mask of 255.255.255.0. The binary value of the host portion is 11010101
    8·1 answer
  • If you have 60fps on your laptop tell me one way you can go to 240fps
    14·2 answers
  • Please answer fast computer picture above​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!