Python error question: attributeError: module 'random' has no attribute 'random'

Asked 2 years ago, Updated 2 years ago, 17 views

I keep getting this error while studying Python, how do I solve it? And why does this error appear?

This is the code I entered.

import random
for i in range(5):
    print(random.randit(1, 10))
C:\Users\PycharmProjects\a\venv\Scripts\python.exe 
C:/Users/PycharmProjects/a/sadfljksdfl.py
Traceback (most recent call last):
  File "C:/Users/PycharmProjects/a/sadfljksdfl.py", line 3, in <module>
   print(random.randit(1, 10))
AttributeError: module 'random' has no attribute 'randit'
Process finished with exit code 1

python

2022-09-21 10:41

1 Answers

random.randint(1, 10)

Try again with

You wrote int wrong as it


2022-09-21 10:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.