98.6k views
4 votes
Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline. coral

User Auralbee
by
5.4k points

1 Answer

1 vote

def reverse_list (num_list):

try:

if num_list.isdigit() == True:

return num_list[::-1]

elif num_list < 0:

return "Negative numbers aren't allowed!"

except ValueError:

return "Invalid input!"

user_list = list (int (input ("Please enter ten random positive numbers: " )))

print (reverse_list (user_list))

User Pointer
by
5.7k points