0% found this document useful (0 votes)
11 views6 pages

Python Basic

Python is a powerful, object-oriented programming language developed by Guido Van Rossum in 1990, known for its simplicity and versatility across various technical fields. It features high-level data structures and supports applications in areas like machine learning, web development, and data science, with a wide range of libraries and frameworks available. Python's execution involves compiling source code into byte code, which is then interpreted into machine code by the Python Virtual Machine (PVM).

Uploaded by

sagarmatiyal0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Python Basic

Python is a powerful, object-oriented programming language developed by Guido Van Rossum in 1990, known for its simplicity and versatility across various technical fields. It features high-level data structures and supports applications in areas like machine learning, web development, and data science, with a wide range of libraries and frameworks available. Python's execution involves compiling source code into byte code, which is then interpreted into machine code by the Python Virtual Machine (PVM).

Uploaded by

sagarmatiyal0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python

Python is a clear and powerful object-oriented programming language,


comparable to Perl, Ruby, or Java. Python is a programming language that
combines features of C and Java. It is simple and easy to learn and provides lots
of high-level data structures.
HISTORY
Python was developed by Guido Van
Rossum in the year 1990 at Stichting
Mathematisch Centrum in the
Netherlands as a successor of a
language called ABC.
Name “Python” picked from TV
Show Monty Python’s Flying Circus.
USE CASE
Python is also versatile and widely
used in every technical field, such as
Machine Learning
, Artificial Intelligence, Web
Development, Mobile Application,
Desktop Application, Scientific
Calculation, etc.
Why learn Python (Features)?
Python provides many useful features to the programmer. These features make
it most popular and widely used language. We have listed below few-essential
feature of Python.
o Easy to use and Learn.
o Expressive Language
o Interpreted Language
o Object-Oriented Language
o Open-Source Language
o Extensible
o Learn Standard Library
o GUI Programming Support
o Integrated
o Embeddable
o Dynamic Memory Allocation
o Wide Range of Libraries and Frameworks

Where is Python used (Applications)?


Python is a general-purpose, popular programming language and it is used in
almost every technical field. The various areas of Python use are given below.
o Data Science
o Data Mining
o Desktop Applications
o Console-based Applications
o Mobile Applications
o Software Development
o Artificial Intelligence
o Web Applications
o Enterprise Applications
o 3D CAD Applications
o Machine Learning
o Computer Vision or Image
Processing Applications.
o Speech Recognitions
Python Popular Frameworks and Libraries (More applications)
Python has wide range of libraries and frameworks widely used in various fields
such as machine learning, artificial intelligence, web applications, etc. We
define some popular frameworks and libraries of Python as follows.
o Web development (Server-side) - Django Flask, Pyramid, CherryPy
o GUIs based applications - Tk, PyGTK, PyQt, PyJs, etc.
o Machine Learning - TensorFlow, PyTorch, Scikit-learn, Matplotlib,
Scipy, etc.
o Mathematics - Numpy, Pandas, etc.

How does Python work?


Byte Code—Byte Code represents the fixed set of instructions created by
Python developers, representing all types of operations, such as arithmetic
operations, comparison operations, memory-related operations, etc.
The size of each byte code instruction is 1 byte or 8 bits.
We can find byte code instructions in the .pyc file.

Python Compiler – A Python Compiler converts the program source code into
byte code. Type of Python Compilers:-

• CPython

• Jpython/ Jython

• PyPy

• RubyPython
• IronPython
• StacklessPython
• Pythonxy
• AnacondaPython
Operation
• Write Source Code / Program
• Compile the Program using Python Compiler
• Compiler Converts the Python Program into byte Code
• Computer/Machine Cannot understand Byte Code so we convert it
into Machine Code using PVM
• PVM uses an interpreter which understands the byte code and
convert it into machine code.
• Machine Code instructions are then executed by the processor and
results are displayed

Python Virtual Machine -Python Virtual Machine (PVM) is a program which


provides programming environment. The role of PVM is to convert the byte
code instructions into machine code so the computer can execute those machine
code instructions and display the output. Interpreter converts the byte code into
machine code and sends that machine code to the computer processor for
execution.

To execute program

• Command Line Window,IDLE ,Notepad or Notepad++,PyCharm,Visual


Studio Code
Variables
In C, Java or some other programming languages, a variable is an identifier or a
name, connected to memory location. In Python, a variable is considered as tag
that is tied to some value. Python considers value as objects. +

Rules of variables
• Every variable name should start with alphabets or underscore (_).
• No spaces are allowed in variable declaration.
• Except underscore (_ ) no other special symbol are allowed in the middle
of the variable declaration
• A variable is written with a combination of letters, numbers, and special
characters _ (underscore)
• No Reserved keyword
Keywords

Python language uses the following keywords which are not available to users
to use them as identifiers.

False await else import pass


None break except in raise
True class finally is return
and continue for lambda try
as def from nonlocal while
assert del global not with
async elif if or yield

Comment
Comments are non-executable statements. A Comment is used to describe the
feature of a program. Comment helps to understand our program, not only
ourselves but also other programmer.
There are two type of programs:-
 Single Line Comment
 Multi line Comment

Single line comment


These comments start with a hash symbol (#).
Ex:-
# I am single Line Comment
# This is my first Python Program
# Adding two numbers
Multiline comment
There is no concept of multi line comment in python but we can create string
starting and ending with triple double quotes (”””) or triple single quotes (’’’)
which can be used as block of comments.
Since strings are not assigned to any variable, then they are removed from
memory by the garbage collector and hence these can be used as comments.
It is not recommended to use triple double quotes or triple single quotes for
writing comments as it internally occupy memory and would waste time of the
interpreter since the interpreter has to check them.
Ex:-
””” (double quoute)
Comment Line 1
Comment Line 2
Comment Line 3
”””
Type:2

’’’(Single quote)

Comment Line 1
Comment Line 2
Comment Line 3
’’’

You might also like