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
Who do we make games for?(single term)
Ket [755]

Answer:

Gamers

Explanation:

5 0
3 years ago
Read 2 more answers
In the Northern Hemisphere, large south-facing windows receive more total sunlight during the day and would be a part of a ___ s
9966 [12]

Answer:

Passive solar heating system

Explanation:

The goal of passive solar heating systems usually refers to the system in which the energy provided by the sun is used for heating and cooling of the living places in a house.

When sunlight falls on the house, the building elements capture the heat energy of the sun and it later releases back this heat when the sun is not there. The main objective of this system is to regulate the room temperature. It is comprised of two main elements, one is the glasses that face towards the south and a thermal mass that is used for heat absorption, storing and distribution of heat.

6 0
3 years ago
PLS HURRY!!<br> Look at the image below
Crank

The output will be 10.

The while loop runs until numb is equal to or less than 13.

25 - 5 = 20

20 - 5 = 15

15 - 5 = 10, which is less than 13 so the loop stops and 10 is printed to the screen.  

4 0
3 years ago
1. Realizați o schemă logică pentru un algoritm care sa calculeze suma primelor
DIA [1.3K]

Explanation:

The clear rendering reads;

"1. Make a logic diagram for an algorithm to calculate the sum of premiums 100 natural numbers.

2. Make a logic diagram that displays a maximum of 2 natural numbers.

3. Make a logic diagram that displays the square of a natural number".

4 0
3 years ago
Someone may choose to own a car instead of leasing because:
ozzi
They dont want to be in debt 
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which mitigation technique would prevent rogue servers from providing false ip configuration parameters to clients?
    5·2 answers
  • Jeremy, a college student, is preparing to give a speech on "Social Responsibilities." He refers to a Web page on a tab using
    10·1 answer
  • What happens if you give false information on your driver license application?
    12·1 answer
  • Which steps would you take to determine how much an employee should be paid? Select all that apply.
    9·1 answer
  • Which note-taking method quickly captures and organizes information?
    9·2 answers
  • Ancestor(X,father(X)) and ancestor(david,george) is they unify or not
    11·1 answer
  • Why are you unable to modify the budget file, when you have the allow full control ntfs permission?
    5·1 answer
  • What is a scholary or systemic investigation or injury about a subject?
    14·1 answer
  • Which of the following not a hardware componet​
    5·1 answer
  • Which of the following formats can algorithms NOT be written in:
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!