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
jolli1 [7]
2 years ago
9

In Python write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs

the values of the list.
Ex: If the input is:

10
5
3
21
2
-6
the output is:

[10, 5, 3, 21, 2]

Code hints: while user_input >0: #This is the number that is greater than 0 from the list that is entered.

print(user_numbers) #Prints out the numbers greater than zero that are inputted at the top part.
Computers and Technology
1 answer:
Lilit [14]2 years ago
3 0

Answer:

ansList =input().split() #get input and split it by space

ansList = [int(i) for i in ansList if int(i)>0] #turn string to integer,and get all positive integers

print(ansList)

Explanation: I think this would work for you. I leace comments in the answer.

You might be interested in
Determine if x(t) is periodic and determine the fundamental period.
Studentka2010 [4]

Answer:

hdiihgguilmjj jduhuiuedoibb

6 0
4 years ago
kayah has created a website that explains what her business does. what type of computer program is needed to access/view kayah's
soldier1979 [14.2K]

Answer:

web browser

Explanation:

A web browser is a program that allows users to view and explore

information on the World Wide Web.

8 0
3 years ago
Read 2 more answers
Write the code to compute and output how many times the value 99 is found in an array of integers named numbers
astraxan [27]
Thank you for being the rare question where you actually provide what language you want your answer in; I approve, and encourage this.

In Java, the following will work.
I made it a bit more versatile to work with others numbers, other than 99, if you so please (if not, just hardcode the 99 in yourself).

// Example list - fill this with numbers yourself.
ArrayList<Integer> nums = new ArrayList<>();
int n = 99;
int count = (int)nums.stream().filter(i -> i == n).count();
System.out.println(n + " occurences.");
8 0
4 years ago
Why are the relational operators called relational?
Pie
If you think about it, all "relational operators" are used to test some kind of relationship between two objects or entities. :)
3 0
4 years ago
Read 2 more answers
In portrait mode, your camera will use what?
vesna_86 [32]

Answer:

A. A Smaller Aperture

Have A Good Day

3 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell all words correctly.
    9·1 answer
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    9·1 answer
  • Give a big-O estimate for the number of operations,
    5·1 answer
  • Explain why the effect of stimulant and depressants do not necessarily counteract<br>each other​
    5·1 answer
  • Write an algorithm to calculate the sum of integer ​
    7·1 answer
  • Who is responsible for developing the physical background for the characters by creating buildings, landscapes, and interiors?
    14·1 answer
  • Which is an example of an operating system? (5 points)
    5·1 answer
  • Whats the overall mood of the song Rags2Riches by rod wave
    14·1 answer
  • Question:
    6·2 answers
  • When an item in a menu is black, it means that _____.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!