grandfathermagic

פונקציה שמחזירה רשימה הפוכה

Apr 29th, 2020
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. # Thorw a list numbers or elements separated by space and i will return it as a reverse  list
  2. user_input = input("Enter a list numbers separated by space  ")
  3. user_input = user_input.split()
  4. print(type(user_input))
  5. number = user_input
  6. i = (len(number)) -1
  7. out_put_list = []
  8. while  i >= 0:
  9.     pop_result = number.pop(i)
  10.     out_put_list.append(pop_result)
  11.     i -= 1
  12.  
  13. print(out_put_list)
Advertisement
Add Comment
Please, Sign In to add comment