Give an example of a shuffle() method?



Give an example of a shuffle() method?..

Answer / Rohit Kumar Mishra

The 'shuffle()' method is a part of Python's built-in 'random' module. It randomly rearranges the elements in a list or any other mutable sequence. For example: 'import random'; 'my_list = [1, 2, 3, 4, 5]'; 'random.shuffle(my_list)'.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

How do you dispose a variable in python?

1 Answers  


What is the purpose of is, not and in operators?

1 Answers  


In python, are there any databases to DB packages?

1 Answers  


What's the worst programming language?

1 Answers  


Is python can be compatible with command prompt?

1 Answers  


What is the use of break statement?

1 Answers  


How do you extend in python?

1 Answers  


Is python call by reference or value?

1 Answers  


What are built in types in python?

1 Answers  


What does the map() function do?

1 Answers  


How do you disconnect from the database?

1 Answers  


How would you implement inheritance in python?

1 Answers  


Categories