Respuesta :

Answer:

Program written in python and executed in jupyter notebook

# creating an empty list  

integer_list = []

# Number of elemets in list as input  

n = int(input("Enter number of elements : "))  

 

# iterating till the range  

for i in range(0, n):  

   element = int(input())

   # if element is positive then add it in list

   if element > 0:  

     integer_list.append(element) # adding the element  

integer_list.sort()

print(integer_list)

Ver imagen zahidahmadkhantanoli

The programming code and the output according to the given sentence is provided below.

Program explanation:

  • Create an empty list.
  • Number of elements in list as input.  
  • Iterate till the range.  
  • If an element is positive (+) then add it in list.

Program code:

s = input()

lst = [int(x) for x in s.split(" ") if int(x)>=0]

lst.sort()

for x in lst:

   print(x,end=" ")

Output:

The attachment of the output is below.

Learn more:

https://brainly.com/question/16854756

Ver imagen Cricetus
ACCESS MORE