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
Write a fragment of code that will test whether an integer variable score contains a valid test score. Valid test scores are in
Klio2033 [76]

Answer:

Following are the code in the C Programming Language.

//set integer datatype variable

int score;

//check condition is the score is in the range of 0 to 100

if(score > 0 && score < 100){

//print if condition is true

printf("Valid test scores");

}else{

//otherwise print the following string.

printf("test scores are Invalid");

}

Explanation:

<u>Following are the description of the code.</u>

In the following code that is written in the C Programming Language.

  • Set an integer data type variable i.e., score.
  • Then, set the if conditional statement to check the condition is the variable "score" is greater than 0 and less the 100.
  • If the following statement is true then print "Valid test scores".
  • Otherwise, it print "test scores are Invalid".
5 0
3 years ago
When typing an outline, you can move a point from a lower level to a higher level by changing the list level from the outline me
Arte-miy333 [17]
A shift+Tab
I hope it’s work
6 0
2 years ago
What feature is not included in most DTP programs?
IceJOKER [234]
Features included in most DTP programs would be kerning, master pages, and WYSIWYG. S video editing isn't included in most programs for DTP
5 0
3 years ago
If one department chair—a professor—can chair only one department, and one department can have only one department chair. The en
vodka [1.7K]

Answer:

1:1

Explanation:

According to my research on different types of relationships between two variables, I can say that based on the information provided within the question the entities PROFESSOR and DEPARTMENT exhibit a 1:1 relationship. In other words there can only be one Professor per Department and vice-versa.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Describe a sub routine​
Maksim231197 [3]

Explanation:

A routine or subroutine, also referred to as a function procedure and sub program is code called and executed anywhere in a program. FOr example a routine may be used to save a file or display the time.

4 0
2 years ago
Other questions:
  • Acrynom for wys or wyg
    10·1 answer
  • Which of the following menu commands would you select to make a copy of an open file and rename it?
    15·1 answer
  • Which of the following hacker attacks against wireless networks are virtually undetectable?
    12·1 answer
  • Which statement best describes a transition in PowerPoint?
    12·1 answer
  • In addition to format commands that are found in the ribbon, which option is available for more extensive formatting?
    11·1 answer
  • Create a program that will read in a Salesperson name, employment status (1=Full-time AND 2=Part-time) and the sales amount.
    5·1 answer
  • Which amendment to the Constitution ended slavery in the United States?
    8·1 answer
  • I need help with yes lol please and thank you
    15·2 answers
  • How would you describe the difference between a syntax error and a logic error?
    13·2 answers
  • What will the computer do in response to a line of code reading # name = input("What is your name?")
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!