shuffle function python code example
Example 1: python randomize list
import random
random.shuffle(list)
Example 2: random.shuffle
import random
list = [20, 16, 10, 5]
random.shuffle(list)
print("Reshuffled list : ",list)
OUTPUT:
Reshuffled list : [16, 5, 10, 20]
Example 3: pop function python
# programming languages list
languages = ['Python', 'Java', 'C++', 'French', 'C']
# remove and return the 4th item
return_value = languages.pop(3)
print('Return Value:', return_value)
# Updated List
print('Updated List:', languages)