

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to shuffle a list of objects in Python?
Python has a random module which provides randomization related functions. The shuffle() function randomizes the sequence of items in a list.
>>> import random >>> l1=['aa',22,'ff',15,90,5.55] >>> random.shuffle(l1) >>> l1 [22, 15, 90, 5.55, 'ff', 'aa'] >>> random.shuffle(l1) >>> l1 ['aa', 'ff', 90, 22, 5.55, 15]
- Related Questions & Answers
- How to shuffle a List in Java
- How to append objects in a list in Python?
- Shuffle or Randomize a list in Java
- How to reverse the objects in a list in Python?
- How to sort the objects in a list in Python?
- Python Program to Shuffle Deck of Cards
- How to map an Object of objects to a SAP List?
- Java Program to shuffle an array using list
- Shuffle an Array in Python
- How to access Python objects within objects in Python?
- How to randomize (shuffle) a JavaScript array?
- How to shuffle a std::vector in C++
- How to convert dictionary into list of JavaScript objects?
- how to shuffle a 2D array in java correctly?
- How can we serialize a list of objects using flexjson in Java?
Advertisements