SlideShare a Scribd company logo
M Vishnuvardhan
Why Python ..?
» Python works on different platforms.
» Python has a simple syntax similar to the English language.
» Python has fewer lines than some other languages.
» Python runs on an interpreter system.
» Python can be treated in a procedural way, an object-
orientated way or a functional way.
M Vishnuvardhan
C, C++, Java VS Python
C C++ JAVA PYTHON
Language Type Procedure Oriented Object Oriented Object Oriented
Both Procedure and
Object Oriented
Building Block Function Driven Object Driven
Both Object and
Class Driven
Function, Object and
Class driven
Extension .c .cpp .java .py
Platform Dependent Independent Independent Independent
Comment Style /* Multi Line */
//Single Line
/*Multi Line*/
//Single Line
/*Multi Line*/
#Single Line
" " " Multi-line " " "
Translator Type Compiled Compiled
Compiled &
Interpreted
Interpreted
Database Connectivity not supported not supported Supported Supported
Representing Block of
Statements
{ } { } { } Indentation
Declaring Variables Required Required Required Not Required
Applications
Compilers,
Interpreters,
Embedded
Programming etc.,
Simple desktop
applications,
Embedded Systems
etc.,
Desktop GUI, Mobile,
Web, Gaming etc.,
Desktop, Web,
Gaming, Network
Programming etc.,
Editors/ IDE Turbo C, Code Blocks
Turbo C++, Code
Blocks
Ecllipse, Netbeans
PyCharm, PyDev,
IDLE, Jupyter
Notebook, Spyder,
VS Code
M Vishnuvardhan
History of Python
»Python was developed by Guido van Rossum in early 90’s
@ National Research Institute for Mathematics and
Computer Science in the Netherlands.
»Python is derived from many other languages, including
ABC, Modula-3, C, C++, Algol-68, Small Talk, and Unix
shell and other scripting languages.
M Vishnuvardhan
History of Python
» Python released 3 major versions
» Python 1.0
» Python 2.0
» Python 3.0
» Python Timeline
M Vishnuvardhan
Features of Python
»Easy-to-learn.
»Easy-to-read.
»Easy-to-maintain.
»Free and Open source.
»Object Oriented.
»Large Standard library(200+)
»High level Interpreted.
»Integrated language.
»Versatile.
»Dynamically Typed
»Portable.
»Extendable.
»Databases.
»GUI Programming.
M Vishnuvardhan
Applications of Python
M Vishnuvardhan
Applications of Python
» Web & Internet Development
» Desktop GUI Applications
» Artificial Intelligence
» Machine Learning
» Image Processing
Applications
» Business Applications
» Games & 3D Graphics
» Network Programming
» Data base Access
M Vishnuvardhan
Top Companies using Python
M Vishnuvardhan
Getting Started with Python
» Python is an open source and can be download from
https://www.python.org/
» Download and install it.
» Python can be accessed in command mode or with Python
Integrated Development and Learning Environment (IDLE)
» Python programs can also be developed using Integrated
Development Environments (IDE).
M Vishnuvardhan
Popular Python IDE
IDE provides variety of features like
» Syntax highlighting
» error checking
» smart typing
» Multiple version support
» Debugging tools
M Vishnuvardhan
Python keywords
False class finally is return
None continue for lambda try
True def from nonlocal while
and del global not with
as elif if or yield
assert else import pass
break except in raise
M Vishnuvardhan
Identifiers in Python
Identifiers are user defined names given to classes, functions,
variables etc., Rules for creating Identifiers
» Should be Short and meaningful
» Alphanumeric both upper and lowercase (A-Z, a-z, 0-9)
» No special chars except underscore (_)
» First character must not be a digit
» It should not be a keyword
» It can be of any length
» Python is a case sensitive language
M Vishnuvardhan
Naming Conventions
» Class names start with an uppercase letter.
» All other identifiers start with a lowercase letter.
» Starting an identifier with a single leading underscore indicates
that the identifier is private.
» Starting an identifier with two leading underscores indicates a
strongly private identifier.
» If the identifier also ends with two trailing underscores, the
identifier is a language-defined special name.
M Vishnuvardhan
Blocks and Indentation
» Indentation refers to the spaces at the beginning of a code line.
» Where in other programming languages the indentation in code is for
readability only, the indentation in Python is very important.
» Python uses indentation to indicate a block of code.
» You have to use the same number of spaces in the same block of code,
otherwise Python will give you an error
Eg: if 5 > 2:
print("Five is greater than two!")
Below statement gives error
if 5 > 2:
print("Five is greater than two!")
M Vishnuvardhan
Python Comments
» Comments can be used to explain Python code.
» Comments can be used to make the code more readable.
» Comments can be used to prevent execution when testing code.
» Comments starts with a #, and Python will ignore them
» Using triple double quotes or triple single quotes can create a
multiline comment
Eg: #This is a comment
""" This is a comment
written in more than just one line """
M Vishnuvardhan
docstring
» Docstring is short for documentation string that occurs at the first
statement in a module, function, class or method definition.
Eg: def cube(num)
""" Functions used to find the cube of number"""
return (num*num*num);
Docstring can be accessed using attribute __doc__ of the function.
Eg: print(cube.__doc__)
Prints Functions used to find the cube of number
M Vishnuvardhan
Python variables
» Variables are containers for storing data values.
» Python has no command for declaring a variable.
» A variable is created the moment you first assign a value to it
x = 5
y = "John"
print(x)
print(y)
» Variables can change type after they have been set.
Eg: x = 5
x = "John"
print(x)
M Vishnuvardhan
Assignments in Python
» Values are assigned to variables using assignment operator.
Eg: x = 5
print(x)
» Python allows to assign values to multiple variables in one line
Eg: x ,y ,z = 5 ,”John” , 56.36
» Python allows to assign the same value to multiple variables.
Eg: x = y = z = 5
M Vishnuvardhan
Python Statements - print
» Python print() function is often used to output variables.
Eg: x = "Python is awesome"
print(x)
» In the print() function, you output multiple variables, separated
by a comma
Eg: x = "Python" y = "is" z = "awesome"
print(x, y, z)
M Vishnuvardhan
When we run a Python program, two steps happen
»The code gets converted to another representation called ‘Byte Code’
»‘Byte Code’ gets converted to Machine Code (which is understandable by the
computer)
Python Virtual machine – PVM
M Vishnuvardhan
Python Virtual machine – PVM
» The second step is being done by PVM or Python Virtual Machine. So PVM
is nothing but a software/interpreter that converts the byte code to
machine code for given operating system.
» PVM is also called Python Interpreter and this is the reason Python is
called an Interpreted language.
» We can’t see the Byte Code of the program because this happens
internally in memory.
» To get the byte code use –m D:> python -m Sample.py
» Creates a pyc file consisting Bytecode
M Vishnuvardhan

More Related Content

Similar to Python Basics.pptx

Python
PythonPython
Python
Aashish Jain
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
pcjoshi02
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
BijuAugustian
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
ArunaPeriyasamy1
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
william john
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Mohammed Rafi
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 
Vks python
Vks pythonVks python
Vks python
Vinod Srivastava
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)
KALAISELVI P
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
Nandini485510
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
Abdul Haseeb
 
Python part1
Python part1Python part1
Python part1
Vishal Dutt
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
shetoooelshitany74
 
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
notwa dfdfvs gf fdgfgh  s thgfgh frg regggnotwa dfdfvs gf fdgfgh  s thgfgh frg reggg
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Godwin585235
 
Python programming
Python programmingPython programming
Python programming
saroja20
 

Similar to Python Basics.pptx (20)

Python
PythonPython
Python
 
INTERNSHIP REPORT.docx
 INTERNSHIP REPORT.docx INTERNSHIP REPORT.docx
INTERNSHIP REPORT.docx
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Vks python
Vks pythonVks python
Vks python
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)
 
Python Module-1.1.pdf
Python Module-1.1.pdfPython Module-1.1.pdf
Python Module-1.1.pdf
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 
Python part1
Python part1Python part1
Python part1
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
 
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
notwa dfdfvs gf fdgfgh  s thgfgh frg regggnotwa dfdfvs gf fdgfgh  s thgfgh frg reggg
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
 
Python programming
Python programmingPython programming
Python programming
 

More from M Vishnuvardhan Reddy

Python Sets_Dictionary.pptx
Python Sets_Dictionary.pptxPython Sets_Dictionary.pptx
Python Sets_Dictionary.pptx
M Vishnuvardhan Reddy
 
Lists_tuples.pptx
Lists_tuples.pptxLists_tuples.pptx
Lists_tuples.pptx
M Vishnuvardhan Reddy
 
Python Control Structures.pptx
Python Control Structures.pptxPython Control Structures.pptx
Python Control Structures.pptx
M Vishnuvardhan Reddy
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
M Vishnuvardhan Reddy
 
Python Operators.pptx
Python Operators.pptxPython Operators.pptx
Python Operators.pptx
M Vishnuvardhan Reddy
 
Python Datatypes.pptx
Python Datatypes.pptxPython Datatypes.pptx
Python Datatypes.pptx
M Vishnuvardhan Reddy
 
DataScience.pptx
DataScience.pptxDataScience.pptx
DataScience.pptx
M Vishnuvardhan Reddy
 
Html forms
Html formsHtml forms
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
M Vishnuvardhan Reddy
 
Java Threads
Java ThreadsJava Threads
Java Threads
M Vishnuvardhan Reddy
 
Java Streams
Java StreamsJava Streams
Java Streams
M Vishnuvardhan Reddy
 
Scanner class
Scanner classScanner class
Scanner class
M Vishnuvardhan Reddy
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
M Vishnuvardhan Reddy
 
Java intro
Java introJava intro
Java applets
Java appletsJava applets
Java applets
M Vishnuvardhan Reddy
 
Exception handling
Exception handling Exception handling
Exception handling
M Vishnuvardhan Reddy
 
Control structures
Control structuresControl structures
Control structures
M Vishnuvardhan Reddy
 
Constructors
ConstructorsConstructors
Constructors
M Vishnuvardhan Reddy
 
Classes&objects
Classes&objectsClasses&objects
Classes&objects
M Vishnuvardhan Reddy
 
Shell sort
Shell sortShell sort

More from M Vishnuvardhan Reddy (20)

Python Sets_Dictionary.pptx
Python Sets_Dictionary.pptxPython Sets_Dictionary.pptx
Python Sets_Dictionary.pptx
 
Lists_tuples.pptx
Lists_tuples.pptxLists_tuples.pptx
Lists_tuples.pptx
 
Python Control Structures.pptx
Python Control Structures.pptxPython Control Structures.pptx
Python Control Structures.pptx
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
 
Python Operators.pptx
Python Operators.pptxPython Operators.pptx
Python Operators.pptx
 
Python Datatypes.pptx
Python Datatypes.pptxPython Datatypes.pptx
Python Datatypes.pptx
 
DataScience.pptx
DataScience.pptxDataScience.pptx
DataScience.pptx
 
Html forms
Html formsHtml forms
Html forms
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Java Threads
Java ThreadsJava Threads
Java Threads
 
Java Streams
Java StreamsJava Streams
Java Streams
 
Scanner class
Scanner classScanner class
Scanner class
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Java intro
Java introJava intro
Java intro
 
Java applets
Java appletsJava applets
Java applets
 
Exception handling
Exception handling Exception handling
Exception handling
 
Control structures
Control structuresControl structures
Control structures
 
Constructors
ConstructorsConstructors
Constructors
 
Classes&objects
Classes&objectsClasses&objects
Classes&objects
 
Shell sort
Shell sortShell sort
Shell sort
 

Recently uploaded

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 

Recently uploaded (20)

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 

Python Basics.pptx

  • 1.
  • 2. M Vishnuvardhan Why Python ..? » Python works on different platforms. » Python has a simple syntax similar to the English language. » Python has fewer lines than some other languages. » Python runs on an interpreter system. » Python can be treated in a procedural way, an object- orientated way or a functional way.
  • 3. M Vishnuvardhan C, C++, Java VS Python C C++ JAVA PYTHON Language Type Procedure Oriented Object Oriented Object Oriented Both Procedure and Object Oriented Building Block Function Driven Object Driven Both Object and Class Driven Function, Object and Class driven Extension .c .cpp .java .py Platform Dependent Independent Independent Independent Comment Style /* Multi Line */ //Single Line /*Multi Line*/ //Single Line /*Multi Line*/ #Single Line " " " Multi-line " " " Translator Type Compiled Compiled Compiled & Interpreted Interpreted Database Connectivity not supported not supported Supported Supported Representing Block of Statements { } { } { } Indentation Declaring Variables Required Required Required Not Required Applications Compilers, Interpreters, Embedded Programming etc., Simple desktop applications, Embedded Systems etc., Desktop GUI, Mobile, Web, Gaming etc., Desktop, Web, Gaming, Network Programming etc., Editors/ IDE Turbo C, Code Blocks Turbo C++, Code Blocks Ecllipse, Netbeans PyCharm, PyDev, IDLE, Jupyter Notebook, Spyder, VS Code
  • 4. M Vishnuvardhan History of Python »Python was developed by Guido van Rossum in early 90’s @ National Research Institute for Mathematics and Computer Science in the Netherlands. »Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, Small Talk, and Unix shell and other scripting languages.
  • 5. M Vishnuvardhan History of Python » Python released 3 major versions » Python 1.0 » Python 2.0 » Python 3.0 » Python Timeline
  • 6. M Vishnuvardhan Features of Python »Easy-to-learn. »Easy-to-read. »Easy-to-maintain. »Free and Open source. »Object Oriented. »Large Standard library(200+) »High level Interpreted. »Integrated language. »Versatile. »Dynamically Typed »Portable. »Extendable. »Databases. »GUI Programming.
  • 8. M Vishnuvardhan Applications of Python » Web & Internet Development » Desktop GUI Applications » Artificial Intelligence » Machine Learning » Image Processing Applications » Business Applications » Games & 3D Graphics » Network Programming » Data base Access
  • 10. M Vishnuvardhan Getting Started with Python » Python is an open source and can be download from https://www.python.org/ » Download and install it. » Python can be accessed in command mode or with Python Integrated Development and Learning Environment (IDLE) » Python programs can also be developed using Integrated Development Environments (IDE).
  • 11. M Vishnuvardhan Popular Python IDE IDE provides variety of features like » Syntax highlighting » error checking » smart typing » Multiple version support » Debugging tools
  • 12. M Vishnuvardhan Python keywords False class finally is return None continue for lambda try True def from nonlocal while and del global not with as elif if or yield assert else import pass break except in raise
  • 13. M Vishnuvardhan Identifiers in Python Identifiers are user defined names given to classes, functions, variables etc., Rules for creating Identifiers » Should be Short and meaningful » Alphanumeric both upper and lowercase (A-Z, a-z, 0-9) » No special chars except underscore (_) » First character must not be a digit » It should not be a keyword » It can be of any length » Python is a case sensitive language
  • 14. M Vishnuvardhan Naming Conventions » Class names start with an uppercase letter. » All other identifiers start with a lowercase letter. » Starting an identifier with a single leading underscore indicates that the identifier is private. » Starting an identifier with two leading underscores indicates a strongly private identifier. » If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.
  • 15. M Vishnuvardhan Blocks and Indentation » Indentation refers to the spaces at the beginning of a code line. » Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. » Python uses indentation to indicate a block of code. » You have to use the same number of spaces in the same block of code, otherwise Python will give you an error Eg: if 5 > 2: print("Five is greater than two!") Below statement gives error if 5 > 2: print("Five is greater than two!")
  • 16. M Vishnuvardhan Python Comments » Comments can be used to explain Python code. » Comments can be used to make the code more readable. » Comments can be used to prevent execution when testing code. » Comments starts with a #, and Python will ignore them » Using triple double quotes or triple single quotes can create a multiline comment Eg: #This is a comment """ This is a comment written in more than just one line """
  • 17. M Vishnuvardhan docstring » Docstring is short for documentation string that occurs at the first statement in a module, function, class or method definition. Eg: def cube(num) """ Functions used to find the cube of number""" return (num*num*num); Docstring can be accessed using attribute __doc__ of the function. Eg: print(cube.__doc__) Prints Functions used to find the cube of number
  • 18. M Vishnuvardhan Python variables » Variables are containers for storing data values. » Python has no command for declaring a variable. » A variable is created the moment you first assign a value to it x = 5 y = "John" print(x) print(y) » Variables can change type after they have been set. Eg: x = 5 x = "John" print(x)
  • 19. M Vishnuvardhan Assignments in Python » Values are assigned to variables using assignment operator. Eg: x = 5 print(x) » Python allows to assign values to multiple variables in one line Eg: x ,y ,z = 5 ,”John” , 56.36 » Python allows to assign the same value to multiple variables. Eg: x = y = z = 5
  • 20. M Vishnuvardhan Python Statements - print » Python print() function is often used to output variables. Eg: x = "Python is awesome" print(x) » In the print() function, you output multiple variables, separated by a comma Eg: x = "Python" y = "is" z = "awesome" print(x, y, z)
  • 21. M Vishnuvardhan When we run a Python program, two steps happen »The code gets converted to another representation called ‘Byte Code’ »‘Byte Code’ gets converted to Machine Code (which is understandable by the computer) Python Virtual machine – PVM
  • 22. M Vishnuvardhan Python Virtual machine – PVM » The second step is being done by PVM or Python Virtual Machine. So PVM is nothing but a software/interpreter that converts the byte code to machine code for given operating system. » PVM is also called Python Interpreter and this is the reason Python is called an Interpreted language. » We can’t see the Byte Code of the program because this happens internally in memory. » To get the byte code use –m D:> python -m Sample.py » Creates a pyc file consisting Bytecode