Answer to Question #349924 in Python for Darkninja

Question #349924

# Accept integer number and store it to a list until user input is 0.

# Display the content of the list and size of the list.

# Display the highest and lowest numbers in the list and the index number it can be found.


1
Expert's answer
2022-06-13T08:27:46-0400
number_lst = []
while True:
    number = int(input())
    if number == 0:
        break
    else:
        number_lst.append(number)

print('The list:', number_lst)
print('Size of the list:', len(number_lst))
print('The highest number is {}, the index is {}'.
      format(max(number_lst), number_lst.index(max(number_lst))))
print('The lowest number is {}, the index is {}'.
      format(min(number_lst), number_lst.index(min(number_lst))))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS