I dont really understand the concept of modules | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

I dont really understand the concept of modules

Are the modules like already predefined constants

12th May 2020, 7:17 PM
Kody
8 Antworten
+ 6
Module is simply a collection of infinite number of codes Python devs wrote for you and you can simply use them in your code by writing import and then module name. And yes, you can create your own modules.
13th May 2020, 1:49 PM
Mehnaz ✨
Mehnaz ✨ - avatar
+ 2
u can also add own modules to local direcory. So but why modules : in the kitchen you have things you need every day to cook: maybe grain, eggs.. Some other things you may have in on stock because u need them occasionally. And some special things you buy when you need. If u had all in the kitchen it would become narrow there. The idea for modules is similar : A set of very common functions is standard in runtime(kitchen) . Some more modules are standard in the library and available by importing them(stock) . For special cases you can install further modules from pypi(discounter) .
14th May 2020, 6:07 AM
Oma Falk
Oma Falk - avatar
0
Python... sorry
12th May 2020, 7:44 PM
Kody
0
I have already read that but I still don't understand......are the modules already predefined constants like pi...or predefined function like sqrt
12th May 2020, 7:47 PM
Kody
0
Ok who created the maths module.....and can I create my own module
12th May 2020, 8:11 PM
Kody
0
Would the .py file be saved with the file ....like how would the idle know where to import it from
12th May 2020, 8:19 PM
Kody
0
And where can I download modules from
12th May 2020, 8:19 PM
Kody
0
Modules like math are in the standard library so there is no need to install anything, but external modules need to be installed with pip. Yes you can also create your own modules, and even publish them to PyPi if you want.
14th May 2020, 5:28 AM
Michael David
Michael David - avatar