0
Can someone explain me what does import in Python?
Working on repl.it
2 Answers
+ 1
Ok. Import random
Here random is a module. If I'll try to explain then it would be like this in easy language - A file or script that is being saved in a directory.
Now import means bringing that file in use in your code.
So import random is basically including a file name random in your program.
Random is a module is used to generate a random number.
There is already a code written inside a file to generate random number. So it's make your work easy if you are working on a big project.
You can also create a code to generate random numbers without using that module. But it saves time that's why.
There are many modules like 'random' in Python.