ModuleNotFoundError: No module named 'Random'

ModuleNotFoundError: No module named ‘Random’

In Python ” ModuleNotFoundError: No module named ‘Random’ ” we face this message when we miss spell or type random (small letter r) module as ad Random (capital letter R) then we face this error. Python is case sensitive coding language so we need to use correct small and capital letters. To fix this error we need to convert the Random into a random.

Wrong Code

import Random

random_integer = random.randint(1, 10)
print(random_integer)

random_float = random.random()
print(random_float)

Error Massage

Traceback (most recent call last):
  File "/home/kali/python/webproject/error/main.py", line 1, in <module>
    import Random
ModuleNotFoundError: No module named 'Random'

Wrong code line

import Random

Correct code line

import random
  • Wrong action: Random (capital letter R) 
  • Correct action: random (small letter r)
  • Convert Random into a random.

Entire Correct Code line

import random

random_integer = random.randint(1, 10)
print(random_integer)

random_float = random.random()
print(random_float)

What is ModuleNotFoundError: No module named ‘Random’?

In Python, we face this error message when we miss spell or type a random (small letter r) module as ad Random (capital letter R) but Random is the incorrect spelling that’s why we face this error.

How to fix ModuleNotFoundError: No module named ‘Random’?

To fix this error we need to convert the Random into a random because Python is case sensitive coding language so we need to use correct small and capital letters.

For more information Visit YouTube Channel.

Scroll to Top
Top 7 Gaming Project In python Save ₹25,000 Laptop under ₹11,999 Top 7 Funny error in Python Unicodeescape Most dangerous error in Python Hero Electric Battery Price In 2023