> Create a list of five elements, where the user enters the value of each element. Print the list created and also the reverse order of that list.
Answers
Answer:
i=5
a=[]
while i>0:
print("Enter number")
num=input()
a.append(num)
i = i-1
print(a)
a.reverse()
print(a)
#####Hope this will help you
Answer:
Given below is the code
Explanation:
Initialize a list and create a loop to ask for the input like so
nums = []
for i in range(0,10):
val = input("Enter your value: ")
nums.append(int(val))
Make sure to cast them to ints or floats then sort the array and print in reverse. So you can do something like this
nums = []
num_inputs = 10
for i in range(0,num_inputs):
val = input("Enter your value: ")
nums.append(float(val))
sorted_nums = sorted(nums)
sorted_nums.reverse()
for i in sorted_nums:
print(i)
You’ll probably want to add a try except statement to check for None types and inputs that aren’t numbers.
See more:
https://brainly.in/question/28641505
#SPJ2