PYTHON:
Python is an interpreted, object oriented, high level programming language with dynamic semantics.. Python supports modules and packages which helps to reuse code (by calling particular module). Python is highly popular in usage of AI, MACHINE LEARNING, DEEP LEARNING and API etc..
Python is one of the easiest programming language to learn. Anyone can learn python easily without programming background. Python is also very famous for simple programming syntax, as like normal English .
In this post, i am trying to explain some Python basics and definitions which, can help you to get some basic stuff of python context.
Variable:
Variable is a reserved memory location to store values (numbers, strings..).
Rules for creating variable:
- A variable name must be start with a letter or the underscore character.
- A variable name cannot start with number.
- A variable name can only contain alpha-numeric character and underscore (A-z, 0-9, _)
Python Module:
Any text file with the .py extension containing Python code is basically a module. If the programming algorithm requires defining lot of functions and classes, they are logically organized in module. One module stores different python objects such as functions, classes, variables, constants, etc,. Such a modular structure of the code makes it easy to understand, use and maintain.
We can create our own module as per requirement and there are some modules also available like math, random and etc,.
Syntax:
from math import sqrt, factorial (to import specific functions from module)
from math import * (to import whole module)
Module Attributes:
A module is described by its attributes. The attributes of a module perform some tasks contain some information.
Ex:
__name__Attribute:
Packages:
We organize a large number of files in different folders and subfolders based on some criteria, so that we can find and manage them easily. In the same way, Package. Physically a package is actually a folder containing one or more module files.
As you know, module contains multiple objects, such as classes, functions, etc. A package can contain one or more relevant modules.
Comments
Post a Comment