how can i fix AttributeError

i want fix AttributeError
i wrote simple code but the output was wrong attribute error how can i fix
##############
import random
r = random.randrange (-5,11)
print (r)

the output
PS D: \ python example> & C: /Users/ny/AppData/Local/Programs/Python/Python310/python.exe "d: /python example/random.py"
Traceback (most recent call last):
File "d: \ python example \ random.py", line 1, in <module>
import random
File "d: \ python example \ random.py", line 2, in <module>
r = random.randrange (-5, 11)
AttributeError: partially initialized module'random' has no attribute'randrange' (most likely due to a circular import)


i change the file name but it's still excist PS D: \ python example> & C: /Users/ny/AppData/Local/Programs/Python/Python310/python.exe "d: /python example / simple.py" Traceback ( most recent call last): File "d: \ python example \ simple.py ", line 1, in <module> import random ModuleNotFoundError: No module named'random'

コメントを投稿

0 コメント