Advertisement
RedstoneHair

Python, list randomizer

Oct 12th, 2022
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. from random import randint
  2. list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  3.  
  4. def random_key(x):
  5. return randint(0, 100)
  6.  
  7. list_randomized = list.copy()
  8. list_randomized.sort(key = random_key)
  9.  
  10. print(list)
  11. print(list_randomized)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement