Exercise 16

Write a program in python that randomly mixes the elements of a given list.

Solution

from random import shuffle
laptop = ['HP', 'Acer', 'Dell', 'Lenovo', 'Thomson', 'Asus']
# mix the elements of the list with the shuffle module
shuffle (laptop)
# show result
print (laptop)

Younes Derfoufi
my-courses.net

Leave a Reply