Reading of integers and negatives in phyton

-2

I'm new to Phyton and I do not know how to create all the code required in the statement. The following statement: Read whole numbers on the keyboard until a negative number is a keyboard. Write, if any, the five largest numbers read. If fewer than five numbers are read, show all numbers read. Restriction It is not allowed to keep in memory more than six numbers read.

    
asked by anonymous 06.03.2018 / 14:24

1 answer

1

To read an integer in python:

x = int(input("Enter a number: "))

To loop until a condition is reached:

while (<expressão_condicional>):
    <código_executado>

An example:

count = 0
while (count < 9):
   print 'The count is:', count
   count = count + 1

Now, regarding the logic of the proposed question, it is quite simple. I suggest you try to sort out the information I've given you. After all, if I posted here, you would not be able to copy and use in your college work, because it would be plagiarism .

    
06.03.2018 / 14:33