I just started to learn python3 and wanted to make a simple program that returned the values of 5 random integers so I tried :
import random
for i in range(5):
x=random.randint(1,6)
print (x)
(EDIT:I changed the filename to tyxaios.py and got the following error)
Traceback (most recent call last):
File "tyxaios.py", line 1, in <module>
import random
File "/home/drunkbanana/Documents/python/random.py", line 4, in <module>
x=random.randint(1,6)
AttributeError: module 'random' has no attribute 'randint'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time
File "/usr/lib/python3.5/tempfile.py", line 184, in <module>
from random import Random as _Random
File "/home/drunkbanana/Documents/python/random.py", line 4, in <module>
x=random.randint(1,6)
AttributeError: module 'random' has no attribute 'randint'
Original exception was:
Traceback (most recent call last):
File "tyxaios.py", line 1, in <module>
import random
File "/home/drunkbanana/Documents/python/random.py", line 4, in <module>
x=random.randint(1,6)
AttributeError: module 'random' has no attribute 'randint'
I have installed pip in my PC (Ubuntu 16.04 LTS) and have tried pip install random
but it doesn't work . I got similar errors when I tried working with the smptlib library and the datetime one .
What should I do ?