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...

How to upload your work on Github (Easy and Fast)

I had a problem with uploading any of my work on Github. Amr El-Naggar, A friend of mine, helped me to upload it fast.  Here we go! Consider this is the file I want to take some project from to upload on my Github:  Click on the bar to write sth new:  Write "cmd" to pop up your command shell Open your Github Profile > Repositories > New > write the name > Create Copy the URL  Back to your Command shell and write:  (only the first time)  git init git add . git commit -m "Any message to say what you have done in this commit" (only the first time)  git remote add origin xxxxxxxxx (replace xxx with the link of the repo, ex: https://github.com/MennaEwas/Numerical-Labs)  git push -u origin master if you edited any files: git add . git commit -m "Any message to say what you have done in this commit" git push -u origin master You can easily copy and paste the lines You have to see Done!  Check the uploaded Files:  Note: If you want t...

MaharaTech: Network Course Summary

I knew it's a long time since my last post. In this post I will try to summarize most of the concepts of MaharaTech Network Course .  The Course Works for beginners and It lasts for 1 hour. If you are a beginner I tell you to plan for this course well. You should schedule 2 hours a day for 5/8 days to get the ultimate benefits of it.  There are 3 main Chapters and I will summarize them so you may return to this post in case you wanted to revise.  Introduction to Computer Networks ISO/OSI Model (7 Layers) TCP/IP Protocol Suite 1.  Introduction to Computer Networks a. Physical layer converts data from 01's to the electrical or optical or electromagnetic image.  b. Datalink layer consists of logical link control to convert, reliable, and flow the data from buckets to frames and preserve the data, resend missing messages. The other is MAC which adds the sender and receiver's physical addresses.  c. Network layer takes segments and converts them to packets. add ...