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]
2 years ago
8

8.11 LAB: Filter and sort a list

Computers and Technology
1 answer:
Helen [10]2 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
Any suggestions on how to write the following Python code?
Ksju [112]

Answer:

Hi

Explanation:

6 0
3 years ago
The part of the computer that provides access to the internet is the
Arlecino [84]
<span>The part of the computer that provides access to the internet is the "modem".
</span>

A modem refers to a hardware device that enables a PC to send and get information over a phone line or a link or satellite association. On account of transmission over a simple phone line, which was at one time the most prevalent approach to get to the internet, the modem changes over information amongst simple and computerized designs progressively for two-way network communication.
4 0
3 years ago
Read 2 more answers
What statement is used to close a loop started with a for statement?
liraira [26]
If I get what you are saying then you could use a work like end. :)
5 0
3 years ago
which of these describes a property of all elements A. all elements have six electrons B. all elements are pure substances C. al
sergiy2304 [10]
Im guessing the answer would either B or C
3 0
3 years ago
Can someone can help me am dont know how much RAM do i need. I use my pc for work and to watch yt vid. Thanks​
Vitek1552 [10]

Answer:

at least 2gb

Explanation:

6 0
3 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n)
    10·2 answers
  • Which type of denial of service attack exploits the existence of software flaws to disrupt a service?
    12·1 answer
  • While the zyLab platform can be used without training, a bit of training may help some students avoid common issues. The assignm
    6·1 answer
  • The "origin" of the cartesian plane in math is the point where x and y are both zero. Given a variable, origin of type Point-- a
    5·1 answer
  • If you’re paid hourly and work 40 hours in one week how much overtime have you worked? 8 hours none $48 or $80
    9·2 answers
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    12·1 answer
  • Which ics function records time accounting and procures needed items?
    12·1 answer
  • Can someone help I think I know it but I wanna make sure I’m right
    10·1 answer
  • How has technology impacted our lives and the world we live in? In your own words.
    9·1 answer
  • When a derived class method has the same name as a base class method, it is often said that the derived class method ________ th
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!