fork download
  1. def reverse(mylist):
  2. newlist = []
  3. for i in mylist:
  4. i *= 2
  5. newlist.append(i)
  6. yourlist = newlist[::-1]
  7. print(yourlist)
  8.  
  9. if __name__ == "__main__":
  10. number = int(input('How many items do you wish to have in the list: '))
  11. index = 0
  12. mylist = []
  13. while index < number:
  14. item = int(input('Enter the element: '))
  15. mylist.append(item)
  16. index += 1
  17. print(mylist)
  18. reverse(mylist)
  19.  
  20.  
Success #stdin #stdout 0.09s 14136KB
stdin
5
10
20
30
40
50
stdout
How many items do you wish to have in the list: Enter the element: Enter the element: Enter the element: Enter the element: Enter the element: [10, 20, 30, 40, 50]
[100, 80, 60, 40, 20]