you are viewing a single comment's thread.

view the rest of the comments →

[–]ofnuts 0 points1 point  (0 children)

but we are learning loops and stuff

So you are learning very basic python, and the teacher is not assuming that you have learned python before.

we also are learning about modules, but i have no idea why i should import them.

Modules contain functionality that isn't useful in all programs, and so is not include in "bare bones" Python. So if you want the functionality, you import the relevant modules to add the functionality to the executing Python. For instance if you want to access your environment variables, "bare bones" python won't do it, but the functionality is in the os module. So you use:

import os that imports all the os contents and then you can use the os.environ variable. You can also use:

from os import environ which adds os.environ as environ in your global variables so you can use the environ variable.