SlideShare a Scribd company logo
1 of 31
Download to read offline
Section: BS in Information Technology - 2A
Day: FRI
Time: 1:00-4:00
Instructor: Percival A. Fernandez, MSIT
WHAT IS PYTHON
• Python is a popular programming language. It was created by Guido van Rossum, and released
in 1991.
• It is used for:
• web development (server-side),
• software development,
• mathematics,
• system scripting.
WHAT IS PYTHON
• Python is a high-level, general-purpose and a very popular programming language. Python
programming language (latest Python 3) is being used in web development, Machine Learning
applications, along with all cutting edge technology in Software Industry.
• Python Programming Language is very well suited for Beginners, also for experienced
programmers with other programming languages like C++ and Java.
• Python is a very popular general-purpose interpreted, interactive, object-oriented, and high-level
programming language. Python is dynamically-typed and garbage-collected programming
language. It was created by Guido van Rossum during 1985- 1990.
• Like Perl, Python source code is also available under the GNU General Public License (GPL).
• Python is a popular programming language.
• Python can be used on a server to create web applications.
CAREERS WITH PYTHON
• If you know Python nicely, then you have a great career ahead. Here are just a few of the
career options where Python is a key skill:
 Game developer
 Web designer
 Python developer
 Full-stack developer
 Machine learning engineer
 Data scientist
 Data analyst
 Data engineer
 DevOps engineer
 Software engineer
 Many more other roles
FACTS ABOUT PYTHON PROGRAMMING LANGUAGE
• Python is currently the most widely used multi-purpose, high-level programming language.
• Python allows programming in Object-Oriented and Procedural paradigms.
• Python programs generally are smaller than other programming languages like Java.
Programmers have to type relatively less and indentation requirement of the language, makes
them readable all the time.
• Python language is being used by almost all tech-giant companies like – Google, Amazon,
Facebook, Instagram, Dropbox, Uber… etc.
FACTS ABOUT PYTHON PROGRAMMING LANGUAGE
• The biggest strength of Python is huge collection of standard library which can be used for the
following:
• Machine Learning
• GUI Applications (like Kivy, Tkinter, PyQt etc. )
• Web frameworks like Django (used by YouTube, Instagram, Dropbox)
• Image processing (like OpenCV, Pillow)
• Web scraping (like Scrapy, BeautifulSoup, Selenium)
• Test frameworks
• Multimedia
• Scientific computing
• Text processing and many more..
WHY TO LEARN PYTHON?
• Python is consistently rated as one of the world's most popular programming languages.
• Python is fairly easy to learn, so if you are starting to learn any programming language then
Python could be your great choice.
• Today various Schools, Colleges and Universities are teaching Python as their primary
programming language.
• There are many other good reasons which makes Python as the top choice of any programmer:
 Python is Open Source which means its available free of cost.
 Python is simple and so easy to learn
 Python is versatile and can be used to create many different things.
 Python has powerful development libraries include AI, ML etc.
 Python is much in demand and ensures high salary
WHY TO LEARN PYTHON?
• Python is a MUST for students and working professionals to become a great Software Engineer
specially when they are working in Web Development Domain. I will list down some of the key
advantages of learning Python:
 Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.
 Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
 Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
 Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from simple
text processing to WWW browsers to games.
CHARACTERISTICS OF PYTHON
• Following are important characteristics of Python Programming −
 It supports functional and structured programming methods as well as OOP.
 It can be used as a scripting language or can be compiled to byte-code for building large
applications.
 It provides very high-level dynamic data types and supports dynamic type checking.
 It supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
APPLICATIONS OF PYTHON
• The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used
language over the web. I'm going to list few of them here:
• Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.
• Easy-to-read − Python code is more clearly defined and visible to the eyes.
• Easy-to-maintain − Python's source code is fairly easy-to-maintain.
• A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
• Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
• Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
APPLICATIONS OF PYTHON
• Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
• Databases − Python provides interfaces to all major commercial databases.
• GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the
X Window system of Unix.
• Scalable − Python provides a better structure and support for large programs than shell
scripting.
PYTHON SYNTAX COMPARED TO OTHER PROGRAMMING
LANGUAGES
• Python was designed for readability, and has some similarities to the English language with
influence from mathematics.
• Python uses new lines to complete a command, as opposed to other programming languages
which often use semicolons or parentheses.
• Python relies on indentation, using whitespace, to define scope; such as the scope of loops,
functions and classes. Other programming languages often use curly-brackets for this purpose.
PYTHON - ENVIRONMENT SETUP
• For python installation – please refer to the following links
• https://www.python.org/about/gettingstarted/
• https://wiki.python.org/moin/BeginnersGuide/Download
• https://www.tutorialspoint.com/python/python_environment.htm
• https://www.w3schools.com/python/python_getstarted.asp
• https://realpython.com/installing-python/
PYTHON - BASIC SYNTAX
• The Python syntax defines a set of rules that are used to create Python statements while writing a
Python Program.
• The Python Programming Language Syntax has many similarities to Perl, C, and Java
Programming Languages. However, there are some definite differences between the languages.
• Python syntax can be executed by writing directly in the Command Line:
• Or by creating a python file on the server, using the .py file extension, and running it in the
Command Line:
PYTHON 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.
• The number of spaces is up to you as a programmer, the most common use is four, but it has to be
at least one.
FIRST PYTHON PROGRAM
Python - Interactive Mode Programming
• We can invoke a Python interpreter from command line by typing python at the command
prompt as following −
• Here >>> denotes a Python Command Prompt where you can type your commands. Let's
type the following text at the Python prompt and press the Enter −
• Python - Script Mode Programming
 We can invoke the Python interpreter with a script parameter which begins the execution of
the script and continues until the script is finished. When the script is finished, the interpreter
is no longer active.
 Let us write a simple Python program in a script which is simple text file. Python files have
extension .py. Type the following source code in a test.py file −
• We assume that you have Python interpreter path set in PATH variable. Now, let's try to run
this program as follows −
FIRST PYTHON PROGRAM
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.
• Creating a Comment
• Comments starts with a #, and Python will ignore them:
• Comments can be placed at the end of a line, and Python will ignore the rest of the line:
PYTHON IDENTIFIERS
• A Python identifier is a name used to identify a variable, function, class, module or other object.
An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more
letters, underscores and digits (0 to 9).
• Python does not allow punctuation characters such as @, $, and % within identifiers.
• Variables are containers for storing data values.
• Creating Variables
• Python has no command for declaring a variable.
• A variable is created the moment you first assign a value to it.
PYTHON IDENTIFIERS
• Casting
• If you want to specify the data type of a variable, this can be done with casting.
PYTHON IDENTIFIERS
• Single or Double Quotes?
• String variables can be declared either by using single or double quotes:
• Case-Sensitive
• Variable names are case-sensitive.
#A will not overwrite a
PYTHON LINES AND INDENTATION
• Python programming provides no braces to indicate blocks of code for class and function
definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly
enforced.
• The number of spaces in the indentation is variable, but all statements within the block must be
indented the same amount. For example −
• However, the following block generates an error −
Thus, in Python all the continuous lines indented with same number
of spaces would form a block.
PYTHON DATA TYPES
• Python Data Types are used to define the type of a variable. It defines what type of data we
are going to store in a variable. The data stored in memory can be of many types.
• For example, a person's age is stored as a numeric value and his or her address is stored as
alphanumeric characters.
PYTHON NUMERIC DATA TYPE
• Python numeric data types store numeric values. Number objects are created when you assign a
value to them. For example −
• Python supports four different numerical types −
• int (signed integers)
• long (long integers, they can also be
represented in octal and hexadecimal)
• float (floating point real values)
• complex (complex numbers)
PYTHON STRING DATA TYPE
• Python Strings are identified as a contiguous set of characters represented in the quotation
marks. Python allows for either pairs of single or double quotes.
• Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in
the beginning of the string and working their way from -1 at the end.
• The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition
operator in Python. For example −
PYTHON OPERATORS
• Operators are used to perform operations on variables and values.
• Python divides the operators in the following groups:
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
• Membership operators
• Bitwise operators
PYTHON ARITHMETIC OPERATORS
• Python arithmetic operators are used to perform
mathematical operations on numerical values. These
operations are Addition, Subtraction, Multiplication,
Division, Modulus, Expoents and Floor Division.
This produce the following result −
PYTHON COMPARISON OPERATORS
• Python comparison operators compare the values on
either sides of them and decide the relation among
them. They are also called relational operators. These
operators are equal, not equal, greater than, less than,
greater than or equal to and less than or equal to.
This produce the following result −
PYTHON ASSIGNMENT OPERATORS
• Python assignment operators are used to assign values
to variables. These operators include simple assignment
operator, addition assign, subtraction assign,
multiplication assign, division and assign operators etc.
This produce the following result −
REFERENCES:
• https://www.python.org/about/gettingstarted/
• https://www.tutorialspoint.com/python/index.htm
• https://www.geeksforgeeks.org/python-programming-language/
• https://www.w3schools.com/python/default.asp

More Related Content

Similar to Python Programming Part 1.pdf

Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
nagendrasai12
 
Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
nagendrasai12
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
Kanchilug
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
Kanchilug
 

Similar to Python Programming Part 1.pdf (20)

Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
 
Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorial
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorial
 
Python Introduction.ppt
Python Introduction.pptPython Introduction.ppt
Python Introduction.ppt
 
Python Introduction.ppt
Python Introduction.pptPython Introduction.ppt
Python Introduction.ppt
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
Presentation (1).pdf
Presentation (1).pdfPresentation (1).pdf
Presentation (1).pdf
 
Presentation (1).pdf
Presentation (1).pdfPresentation (1).pdf
Presentation (1).pdf
 
THE ULTIMATE GUIDE ON PYTHON
THE ULTIMATE GUIDE ON PYTHONTHE ULTIMATE GUIDE ON PYTHON
THE ULTIMATE GUIDE ON PYTHON
 
THE ULTIMATE GUIDE ON PYTHON
THE ULTIMATE GUIDE ON PYTHONTHE ULTIMATE GUIDE ON PYTHON
THE ULTIMATE GUIDE ON PYTHON
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Python Programming.pdf
Python Programming.pdfPython Programming.pdf
Python Programming.pdf
 
Python Programming.pdf
Python Programming.pdfPython Programming.pdf
Python Programming.pdf
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 

More from percivalfernandez2 (7)

Module 3 - Software Classification.pptx
Module 3 - Software Classification.pptxModule 3 - Software Classification.pptx
Module 3 - Software Classification.pptx
 
Data Analytics.pptx
Data Analytics.pptxData Analytics.pptx
Data Analytics.pptx
 
Python Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptxPython Programming Part 8 - MYSQL.pptx
Python Programming Part 8 - MYSQL.pptx
 
Python Programming Part 1.pdf
Python Programming Part 1.pdfPython Programming Part 1.pdf
Python Programming Part 1.pdf
 
Wk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptxWk8_Expansion and External Input and Output Devices.pptx
Wk8_Expansion and External Input and Output Devices.pptx
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
 
Python Programming Part 3.pdf
Python Programming Part 3.pdfPython Programming Part 3.pdf
Python Programming Part 3.pdf
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 

Python Programming Part 1.pdf

  • 1. Section: BS in Information Technology - 2A Day: FRI Time: 1:00-4:00 Instructor: Percival A. Fernandez, MSIT
  • 2.
  • 3. WHAT IS PYTHON • Python is a popular programming language. It was created by Guido van Rossum, and released in 1991. • It is used for: • web development (server-side), • software development, • mathematics, • system scripting.
  • 4. WHAT IS PYTHON • Python is a high-level, general-purpose and a very popular programming language. Python programming language (latest Python 3) is being used in web development, Machine Learning applications, along with all cutting edge technology in Software Industry. • Python Programming Language is very well suited for Beginners, also for experienced programmers with other programming languages like C++ and Java. • Python is a very popular general-purpose interpreted, interactive, object-oriented, and high-level programming language. Python is dynamically-typed and garbage-collected programming language. It was created by Guido van Rossum during 1985- 1990. • Like Perl, Python source code is also available under the GNU General Public License (GPL). • Python is a popular programming language. • Python can be used on a server to create web applications.
  • 5. CAREERS WITH PYTHON • If you know Python nicely, then you have a great career ahead. Here are just a few of the career options where Python is a key skill:  Game developer  Web designer  Python developer  Full-stack developer  Machine learning engineer  Data scientist  Data analyst  Data engineer  DevOps engineer  Software engineer  Many more other roles
  • 6. FACTS ABOUT PYTHON PROGRAMMING LANGUAGE • Python is currently the most widely used multi-purpose, high-level programming language. • Python allows programming in Object-Oriented and Procedural paradigms. • Python programs generally are smaller than other programming languages like Java. Programmers have to type relatively less and indentation requirement of the language, makes them readable all the time. • Python language is being used by almost all tech-giant companies like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
  • 7. FACTS ABOUT PYTHON PROGRAMMING LANGUAGE • The biggest strength of Python is huge collection of standard library which can be used for the following: • Machine Learning • GUI Applications (like Kivy, Tkinter, PyQt etc. ) • Web frameworks like Django (used by YouTube, Instagram, Dropbox) • Image processing (like OpenCV, Pillow) • Web scraping (like Scrapy, BeautifulSoup, Selenium) • Test frameworks • Multimedia • Scientific computing • Text processing and many more..
  • 8. WHY TO LEARN PYTHON? • Python is consistently rated as one of the world's most popular programming languages. • Python is fairly easy to learn, so if you are starting to learn any programming language then Python could be your great choice. • Today various Schools, Colleges and Universities are teaching Python as their primary programming language. • There are many other good reasons which makes Python as the top choice of any programmer:  Python is Open Source which means its available free of cost.  Python is simple and so easy to learn  Python is versatile and can be used to create many different things.  Python has powerful development libraries include AI, ML etc.  Python is much in demand and ensures high salary
  • 9. WHY TO LEARN PYTHON? • Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python:  Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.  Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.  Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.  Python is a Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.
  • 10. CHARACTERISTICS OF PYTHON • Following are important characteristics of Python Programming −  It supports functional and structured programming methods as well as OOP.  It can be used as a scripting language or can be compiled to byte-code for building large applications.  It provides very high-level dynamic data types and supports dynamic type checking.  It supports automatic garbage collection.  It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
  • 11. APPLICATIONS OF PYTHON • The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used language over the web. I'm going to list few of them here: • Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly. • Easy-to-read − Python code is more clearly defined and visible to the eyes. • Easy-to-maintain − Python's source code is fairly easy-to-maintain. • A broad standard library − Python's bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh. • Interactive Mode − Python has support for an interactive mode which allows interactive testing and debugging of snippets of code. • Portable − Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
  • 12. APPLICATIONS OF PYTHON • Extendable − You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient. • Databases − Python provides interfaces to all major commercial databases. • GUI Programming − Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix. • Scalable − Python provides a better structure and support for large programs than shell scripting.
  • 13. PYTHON SYNTAX COMPARED TO OTHER PROGRAMMING LANGUAGES • Python was designed for readability, and has some similarities to the English language with influence from mathematics. • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses. • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.
  • 14. PYTHON - ENVIRONMENT SETUP • For python installation – please refer to the following links • https://www.python.org/about/gettingstarted/ • https://wiki.python.org/moin/BeginnersGuide/Download • https://www.tutorialspoint.com/python/python_environment.htm • https://www.w3schools.com/python/python_getstarted.asp • https://realpython.com/installing-python/
  • 15. PYTHON - BASIC SYNTAX • The Python syntax defines a set of rules that are used to create Python statements while writing a Python Program. • The Python Programming Language Syntax has many similarities to Perl, C, and Java Programming Languages. However, there are some definite differences between the languages. • Python syntax can be executed by writing directly in the Command Line: • Or by creating a python file on the server, using the .py file extension, and running it in the Command Line:
  • 16. PYTHON 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. • The number of spaces is up to you as a programmer, the most common use is four, but it has to be at least one.
  • 17. FIRST PYTHON PROGRAM Python - Interactive Mode Programming • We can invoke a Python interpreter from command line by typing python at the command prompt as following − • Here >>> denotes a Python Command Prompt where you can type your commands. Let's type the following text at the Python prompt and press the Enter −
  • 18. • Python - Script Mode Programming  We can invoke the Python interpreter with a script parameter which begins the execution of the script and continues until the script is finished. When the script is finished, the interpreter is no longer active.  Let us write a simple Python program in a script which is simple text file. Python files have extension .py. Type the following source code in a test.py file − • We assume that you have Python interpreter path set in PATH variable. Now, let's try to run this program as follows − FIRST PYTHON PROGRAM
  • 19. 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. • Creating a Comment • Comments starts with a #, and Python will ignore them: • Comments can be placed at the end of a line, and Python will ignore the rest of the line:
  • 20. PYTHON IDENTIFIERS • A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9). • Python does not allow punctuation characters such as @, $, and % within identifiers. • Variables are containers for storing data values. • Creating Variables • Python has no command for declaring a variable. • A variable is created the moment you first assign a value to it.
  • 21. PYTHON IDENTIFIERS • Casting • If you want to specify the data type of a variable, this can be done with casting.
  • 22. PYTHON IDENTIFIERS • Single or Double Quotes? • String variables can be declared either by using single or double quotes: • Case-Sensitive • Variable names are case-sensitive. #A will not overwrite a
  • 23. PYTHON LINES AND INDENTATION • Python programming provides no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced. • The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount. For example − • However, the following block generates an error − Thus, in Python all the continuous lines indented with same number of spaces would form a block.
  • 24. PYTHON DATA TYPES • Python Data Types are used to define the type of a variable. It defines what type of data we are going to store in a variable. The data stored in memory can be of many types. • For example, a person's age is stored as a numeric value and his or her address is stored as alphanumeric characters.
  • 25. PYTHON NUMERIC DATA TYPE • Python numeric data types store numeric values. Number objects are created when you assign a value to them. For example − • Python supports four different numerical types − • int (signed integers) • long (long integers, they can also be represented in octal and hexadecimal) • float (floating point real values) • complex (complex numbers)
  • 26. PYTHON STRING DATA TYPE • Python Strings are identified as a contiguous set of characters represented in the quotation marks. Python allows for either pairs of single or double quotes. • Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end. • The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator in Python. For example −
  • 27. PYTHON OPERATORS • Operators are used to perform operations on variables and values. • Python divides the operators in the following groups: • Arithmetic operators • Assignment operators • Comparison operators • Logical operators • Identity operators • Membership operators • Bitwise operators
  • 28. PYTHON ARITHMETIC OPERATORS • Python arithmetic operators are used to perform mathematical operations on numerical values. These operations are Addition, Subtraction, Multiplication, Division, Modulus, Expoents and Floor Division. This produce the following result −
  • 29. PYTHON COMPARISON OPERATORS • Python comparison operators compare the values on either sides of them and decide the relation among them. They are also called relational operators. These operators are equal, not equal, greater than, less than, greater than or equal to and less than or equal to. This produce the following result −
  • 30. PYTHON ASSIGNMENT OPERATORS • Python assignment operators are used to assign values to variables. These operators include simple assignment operator, addition assign, subtraction assign, multiplication assign, division and assign operators etc. This produce the following result −
  • 31. REFERENCES: • https://www.python.org/about/gettingstarted/ • https://www.tutorialspoint.com/python/index.htm • https://www.geeksforgeeks.org/python-programming-language/ • https://www.w3schools.com/python/default.asp