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
notsponge [240]
3 years ago
8

8.11 LAB: Filter and sort a list

Computers and Technology
1 answer:
Helen [10]3 years ago
6 0

nums = input("Enter your numbers: ")

lst = nums.split()

new_lst = ([])

for i in lst:

   if int(i) >= 0:

       new_lst.append(int(i))

new_lst.sort()

for x in new_lst:

   print(x, end=" ")

The above code is in case the user enters the numbers.

def func(lst):

   lst.sort()

   for i in lst:

       if i >=0:

           print(i, end=" ")

lst = ([10,-7, 4, 39, -6, 12, 2])

func(lst)

The above code is in case you must input the numbers manually via a function.

I hope this helps!

You might be interested in
When creating a document template, you can either start from an existing document or begin from _____.
Anna35 [415]
A new blank document
7 0
3 years ago
Is ROBLOX for kids?<br><br> A: Yes<br><br> B: No
Annette [7]
ROBLOX is for everyone
8 0
4 years ago
Read 2 more answers
A Windows user is attempting to exit a locked up desktop application that is not responding to mouse or keyboard input. Which of
Kamila [148]

Answer:

Open Task Manager and end the process associated with the application.

Explanation:

When using a computer installed with the Windows Operating system and an application is not responding to the mouse or keyboard input, you can end such application process without exiting other open applications by opening the task manager using the key combinations "CTRL + ALT + DEL". This would open the Task Manager showing all the open application and then you can end the process associated with the application that is not responding.

3 0
4 years ago
Which of the following cells can't be recharged
Andrew [12]
The A. Primary cell can not be recharged or the primary cell is not a rechargeable cell. The choices above are the several types of the battery cell which are used for preserving electric energy. There are two major types of the battery cell which are the primary and the secondary cell based on its recharging ability<span>. The other choices besides the primary cell are the secondary cell.</span>
5 0
4 years ago
What is a best practice when approaching an automation effort?
Sauron [17]
Not sure bro. What’s the question reslly about?
5 0
3 years ago
Other questions:
  • Directions: pick the right letter for each number.
    11·2 answers
  • What device operates at the network layer (layer 3) of the osi model and forwards packets across computer networks?
    7·1 answer
  • Many of the web server controls have a _____ menu that gives developers options to perform common tasks and settings
    15·1 answer
  • If you select three separate parcels from a parcel feature class, how many rows would be selected in the associated attribute ta
    13·1 answer
  • Write a program that will read in a line of text and output the number of words in the line and the number of occurrences of eac
    11·1 answer
  • What term describes a wireless network topology in which access points work as peer devices on the same network?
    14·1 answer
  • Default tab stops are set in word every _______ inch. a. ¾ b. ½ c. 1 d. ¼
    7·1 answer
  • Please help!!!! will mark brainliest!!
    7·2 answers
  • Terrell, a programmer, is creating a website for an online merchant and wants the program to calculate the total price based on
    14·2 answers
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!