AttributeError: module 'random' has no attribute 'randint'
已回答
I am getting an error, while writing a simple random number generating code.
How can this be resolved. I just recently took up learning python and tried to code in pycharm.

请先登录再写评论。
Hello!
If you run this script with the same python interpreter in the Terminal, you will get the same result so the problem is not Pycharm-related.
This error happens because of imports order in python: first, python looks at your local modules and then go to the system ones. In your case, python found your project module `random` instead of a standard python module with the same name - that's why you got this error message.
You need to rename your project file "random.py" to something else.
thank you! I had the same problem:-)