Skip to main content

Core Python Crash Course (Modules)

As I mentioned before those crash courses are not for ultimate beginners. If it is your first time to code I don't support reading this Topic. If you are a programming Fan, you would Like it.

It is a crash course of a course on Udemy. In this topic, we will discuss:

1. Modules:

Modular Programming means breaking a large programming task into separate, smaller modules.
Advantages of Modules: 1) simple: It doesn't focus on the whole problem but a specific part of it. This makes development easier and less error-prone.
2) Maintainability: It focuses on a specific domain and minimizes the interdependency of those modules.
3) Reusability 4) Scoping: For each its namespace.

Functions, modules, and packages are all constructs in Python that promote code modularization.
There are 3 types of Python modules ( Written in Python itself, Written in C and loaded at runtime, built-in modules)

We focus now on The built-in modules:
This is how to call a module.

1. import (module name).
2. s and foo are in the module (private symbols) They are like functions.


The built-in function dir() returns a list of defined names in a namespace. Without arguments, it produces an alphabetically sorted list of names in the current local symbol table

import mod
>>> dir(mod)

Different ways to call a module: 

import (module name)  as (abbreviation)
(abbreviation).(Private symbol) OR  from (module name) import*

Comments

Popular posts from this blog

Miserable

 This one word could describe my life right now. I am writing this because of the last book I read talking about how to re-organize your life. 32 days ago, my dad has gone. In the beginning, I couldn't cry. Now, I can't stop crying about everything. Everything reminds me of him. His favorite stuff became my nightmare. I dream of him every day, too. One week from his death, I took my exams. I didn't remember how I did in them. I knew they were not how I supposed to do, but I am not aware of how I did. I wish I could have cried when he passed. I wanted to cry a lot but I didn't have the ability to face myself with the fact of his death.  He died between my shoulders. I just saw his color turned to yellow like how my grandpa seemed before death. I heard my brother told him some prayers that a person says before death and I just shouted at him to stop. I spent time squeezing his feet to make him shocked. I even talked to him, I said don't go, don't leave me, not now...

My First year in CSE

I always wanted to be in Computer Science. I never tried to challenge myself in this area, too. I felt like I always have this barrier not to go through it. I'm so happy that in the previous 4 months I pushed myself fast and strongly to go in this field. There is a lot of paths in front of me.  I was afraid that most of the students around me in my department have skills more than me. They are so smart and hardworking, too.  In these 4 months I've tried to:  1. get 4 stars in problem-solving on  Hackerrank 2. publish my first website on  GitHub 3. edit my account on LinkedIn 4. start my program in frontend development on Coursera 5. take more than a course on C 6. Start a course related to computer architecture.  7. Start reading about Deep Learning But, How under quarantine I could do all of that.  First of all, I knew how this is a competitive field.  1. I put a counter to know how much time I ...

Hobbies but no time!

Hi hi hi, It's been a long time since the last time here. I know I am probably not your model, besides writing my blog in English makes it not easy to scroll down.  Today I am talking about Hobbies and how to back to your hobbies while your schedule is crowded like a shit. 1. Know Your Hobbies      You need to list your favorite 10 hobbies and if you wanna try sth in the future related to this field     My 10 are [Walking, Dancing, Reading, Learning, Writing, Domino, Complete words, Sports, Problem Solving]     and I wanted to learn chess.  2. Get The Best 3 Out of Them     After listing your hobbies go rank them with stars, what your good at, and so on. Should we quiet any of the last 10? I don't think so.  3. You Just Need to Focus     I do like Dancing but I have no time to learn it. So, You put your hobbies and choose 1 or 2 to learn more about it. for example, the learnable hobbies from mine are [Dancing, Learnin...