This program is using the python built-in module random to shuffle a given list of animal names. The first line is importing the function shuffle from the random module. Then the list of animal names is defined and assigned to the variable animal. The shuffle function is then used on the animal list, which randomly rearranges the elements of the list. Finally, the shuffled list is printed using the print() function.
from random import shuffle animal = ["Cat", "Dog", "Elephant", "Fox", "Tiger", "Lion", "Ponda"] shuffle(animal) print(animal)
['Fox', 'Cat', 'Tiger', 'Lion', 'Dog', 'Ponda', 'Elephant']
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions