Posts

Showing posts with the label Basics of Python

Modules

Image
A python module can be defined as a python program file which contains a python code including python functions, class, or variables. In other words, we can say that our python code file saved with the extension (.py) is treated as the module. We may have a runnable code inside the python module. Modules in Python provides us the flexibility to organize the code in a logical way. To use the functionality of one module into another, we must have to import the specific module. Example In this example, we will create a module named as file.py which contains a function func that contains a code to print some message on the console. Let's create the module named as file.py. Here, we need to include this module into our main module to call the method displayMsg() defined in the module named file. LOADING THE MODULE IN OUR PYTHON CODE We need to load the module in our python code to use its functionality. Python provides two types of statements as defined below. The import statement The f...

Basics of Python

Image
What is Python: - Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido Van Rossum during 1985-1990.  It is used for: Web Development (Server-side) Software Development Mathematics System Scripting What can Python do? Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development. Why Python? Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) Python has a simple syntax similar to the English language. Python has a syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed as so...