[PYTHON] Error in random.shuffle

import random

a=range(10) random.shuffle(a) print(a)

If you enter a code like, you will get the following error:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users//PycharmProjects/demo4.py Traceback (most recent call last): File "/Users//PycharmProjects/demo4.py", line 6, in random.shuffle(a) File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/random.py", line 274, in shuffle x[i], x[j] = x[j], x[i] TypeError: 'range' object does not support item assignment

Process finished with exit code 1

Random.randint (a, b) can generate random numbers normally, so I think there is no problem with importing random. Please help someone.

Recommended Posts

Error in random.shuffle
Error in Pyinstaller
Error in TensorBoard
Error handling in PythonBox
zipimporter error in pyramid
Multiprocessing error in Jupyter Notebook
Slice error in python (´ ; ω ; `)
Solver Problem Error in poetry
[Error handling] peewee.IntegrityError 1451 occurs in peewee
An error occurred in scikit-learn imputer
Fix setuptools missing error in anaconda
How to suppress display error in matplotlib
The story of an error in PyOCR
In pip install clang: error: unknown argument:'-mno-fused-madd'
[Illegal hardware instruction python] error in PyMC3
Error recording
Resolve the Address already in use error
I'm saving in UTF-8 but Syntax Error
Dictionary key error → Resolve with key in dicionary
Solution for run-time error in OpenVINO IEPlugin.load ()
Homebrew error
Import Error in Python3: No module named'xxxxx'
When I get a chromedriver error in Selenium
AttributeError: module'urllib' has no attribute'request' error in urllib.request
Resolve Japanese write error UnicodeEncodeError in Python files
ModuleNotFoundError: No module named'_bz2' error in pyenv Python
[Django] Error when SlugField is specified in .filter ()
DISPLAY error in wxPython (and traitsui) on vscode
Display error message when login fails in Django
Could not import C error in GO environment
To write to Error Repoting in Python on GAE
Use a custom error page in python / tornado
Error when trying to install psycopg2 in Python
[python] ERROR: Python headers are missing in /usr/include/python3.X m.
Error running Jupyter Notebook in Anaconda virtual environment
Date of Address already in use error in Flask
Error in Flask OSError: [Errno 98] Address already in use