+ 1
Why do I need to import modules first?
Can't I just write modules directly to do whatever I want? Pls explain why I can't do this.Thx!!!
4 ответов
+ 2
Try import.random
Don't forget the period, it is needed to run a module.
+ 1
What do you mean? You can write your own.
Just create a new Python file (.py) and write your code there. Then import it using the import command as you would with any other modules.
0
Sorry!It's my fault.
What I mean is before I type
for i in range(5):
print(random.randint(1,5))
I need to type
"import random" first.
Isn't it already built in python?
0
thx!!!