Python3 Func Number Shuffle
# Python3.x Python3 shuffle() Function
[ Python3 Numbers](#)
* * *
## Description
The **shuffle()** method randomly reorders all elements in a sequence.
* * *
## Syntax
Here is the syntax for the shuffle() method:
import random random.shuffle(lst)
**Note:** shuffle() cannot be accessed directly; you need to import the random module and then call the method through the random static object.
* * *
## Parameters
* lst -- A list.
* * *
## Return Value
Returns None.
* * *
## Example
The following example demonstrates the use of the shuffle() method:
## Example
#!/usr/bin/python3 import random list = [20, 16, 10, 5]; random.shuffle(list)print("Randomly sorted list : ", list)random.shuffle(list)print("Randomly sorted list : ", list)
The output of the above example after running is:
Randomly sorted list : [20, 5, 16, 10]Randomly sorted list : [5, 20, 10, 16]
[ Python3 Numbers](#)
YouTip