SlideShare a Scribd company logo
Python Programming
UNIT I
Introduction: History of Python,
Need of Python Programming, Applications,
Basics of PythonProgramming Using the REPL(Shell),
Running Python Scripts, Variables,
Assignment, Keywords, Input-Output,Indentation.
python
•Python was developed by Guido van
Rossum in the late eighties and early
nineties at the 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, SmallTalk, Unix shell,
and other scripting languages
•At the time when he began implementing Python, Guido van Rossum was
also reading the published scripts from "Monty Python's Flying Circus" (a
BBC comedy series from the seventies, in the unlikely case you didn't know).
It occurred to him that he needed a name that was short, unique, and
slightly mysterious, so he decided to call the language Python.
Programming languages
Programming languages
Python
Python history
Python programming language introduction unit
Python programming language introduction unit
Python
• Python is a high-level, interpreted, interactive
and object-oriented scripting language.
Python is designed to be highly readable
Need of Python Programming
• 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.
Need of Python Programming
Interactive Mode: Python has support for an
interactive mode which allows interactive
testing and debugging of snippets of code.
Need of Python Programming
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.
Need of Python Programming
• 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.
Need of Python Programming
• Scalable: Python provides a better structure
and support for large programs than shell
scripting.
Need of Python Programming
• Software quality
Python code is designed to be
readable, and hence reusable
and maintainable— much more
so than traditional scripting
languages. The uniformity of
Python code makes it easy to
understand, even if you did not
write it.
Need of Python Programming
Developer productivity
Python boosts developer productivity many
times beyond compiled or statically typed
languages such as C, C++, and Java.
Python code is typically one-third to less to debug, and less to maintain after the fact.
Python programs also run immediately, without the lengthy compile and link steps
required by some other tools
Need of Python Programming
• Support libraries
Python comes with a large collection of prebuilt and
portable functionality, known as the standard
library. This library supports an array of application-
level programming tasks, from text pattern
matching to network scripting.
Need of Python Programming
It's Object-Oriented
Python is an object-
oriented language, from
the ground up. Its class
model supports
advanced notions such
as polymorphism,
operator overloading,
and multiple inheritance
Need of Python Programming
• It's Free
Python is freeware—Its open source software.
Download and use it.
Need of Python Programming
• It's Portable
Python is written in portable ANSI C, and
compiles and runs on virtually every major
platform in use today. For example, it runs on
UNIX systems, Linux, MS-DOS, MS-Windows (95,
98, NT), Macintosh, Amiga, Be-OS, OS/2, VMS,
QNX, and more
Need of Python Programming
• It's Powerful
From a features perspective, Python is
something of a hybrid. Its tool set places it
between traditional scripting languages (such as
Tcl, Scheme, and Perl), and systems languages
(such as C, C++, and Java).
Need of Python Programming
Automatic memory management
Python automatically allocates
and reclaims ("garbage collects")
objects when no longer used, and
most grow and shrink on demand.
Need of Python Programming
It's Easy to Use
simplicity make
programming more fun
than work.
To run a Python program, you simply type it
and run it. There are no intermediate
compile and link steps (as when using
languages such as C or C++).
It's Easy to Learn
Compared to other
programming languages,
the core Python
language is amazingly
easy to learn.
Need of Python Programming
Internet Scripting
Python comes with standard Internet utility
modules that allow Python programs to
communicate over sockets, extract form
information sent to a server-side CGI script,
parse HTML, transfer files by FTP, process XML
files, and much more.
Need of Python Programming
Database Programming
Python provides a simple object-persistence
system: it allows programs to easily save and
restore entire Python objects to files. For more
traditional database demands, there are Python
interfaces to Sybase, Oracle, Informix, ODBC, and
more.
Need of Python Programming
• Image Processing, AI, Distributed Objects, Etc.
• Python is commonly applied in more domains
than can be mentioned here.
• For instance, image processing for Python is
implemented as a set of library components
implemented in a compiled language such as C,
along with a Python frontend layer on top used to
configure and launch the compiled components.
• Machine Learning,AI,IOT….
Who Uses Python Today?
• Google makes extensive use of Python in its web search systems.
• The popular YouTube video sharing service is largely written in
Python.
• The Raspberry Pi single-board computer promotes Python as its
educational language.
• The widespread BitTorrent peer-to-peer file sharing system began
its life as a Python program.
• Google‘s App Engine web development framework uses Python as
an application language.
• Maya, a powerful integrated 3D modeling and animation system,
provides a Python scripting API.
• Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use
Python for hardware testing.
• NASA, Los Alamos, Fermilab, JPL, and others use Python for
scientific programming tasks.
• And many more……………….
The Python Virtual Machine:
• Once your program has been compiled to byte
code (or the byte code has been loaded from
existing .pyc file), it is shipped off for
execution to something generally known as
the python virtual machine (PVM).
Applications of Python:
• Systems Programming
• GUIs
• Internet Scripting
• Database Programming
• Rapid Prototyping
• Numeric and Scientific
Programming
• …………
Python’s Technical Strengths?
• It‘s Object-Oriented and Functional
• It‘s Free
• It‘s Portable
• It‘s Powerful
• It‘s Mixable
• It‘s Relatively Easy to Use
• It‘s Relatively Easy to Learn
Installation of python
Installation in ubuntu
• commands:
1)cd /usr/src sudo wget
2)https://www.python.org/ftp/python/3.7.3/Py
thon-3.7.3.tgz
3)sudo tar xzf Python-3.7.3.tgz
4)cd Python-3.7.3
Running Python:
Running Python Interpreter:
Python comes with an interactive interpreter.
When you type python in your shell or
command prompt, the python interpreter
becomes active with a >>> prompt and waits
for your commands.
Running Python:
Running Python Scripts in IDLE:
•Goto File menu click on New File (CTRL+N) and write the code
and save add.py a=input("Enter a value ")
b=input("Enter b value ") c=a+b
print "The sum is",c
•And run the program by pressing F5 or Run Run Module.
Running python scripts in Command Prompt:
Before going to run we have to check the PATH in
environment variables.
Open your text editor, type the following text and
save it as hello.py.
print "hello"
And run this program by calling python hello.py. Make
sure you change to the directory where you saved
the file before doing it.
Running Python:
Variables
Variables in a computer program
are similar to buckets
where information can be maintained
Python Variables
• Variables are nothing but reserved memory
locations to store values. when you create a
variable you reserve some space in memory.
• Variables are containers for storing data values.
• Based on the data type of a variable, the
interpreter allocates memory and decides what
can be stored in the reserved memory. Therefore,
by assigning different data types to variables, you
can store integers, decimals or characters in these
variables
int x;
float y;
x=10
y=20.5
Variables
x=10
y=20.5
C/C++ python
x is automatically
treated as int because
10 is integer value
y is automatically
Treated as float
because 20.5 is
float value
x is
declared
as integer
y is
declared
as float
In Python,there is no need to declare a variable.A variable is created the moment
you first assign a value to it
Variable Names
• A variable can have a short name (like x and y) or a
more descriptive name (age, carname, total_volume).
Rules for Python variables:
• A variable name must start with a letter or the
underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric
characters and underscores (A-z, 0-9, and _ )
• Variable names are case-sensitive (age, Age and AGE
are three different variables)
Assigning Values to Variables
• Python variables do not need explicit
declaration to reserve memory space. The
declaration happens automatically when you
assign a value to a variable. The equal sign (=)
is used to assign values to variables.
• The operand to the left of the = operator is
the name of the variable and the operand to
the right of the = operator is the value stored
in the variable.
Python programming language introduction unit
Multiple Assignments to variables
• Python allows you to assign a single value to several
variables simultaneously.
• For example –
• a = b = c = 1
• Here, an integer object is created with the value 1, and all
three variables are assigned to the same memory location.
You can also assign multiple objects to multiple variables.
• For example –
• a, b, c = 1, 2.5, ”lakshman”
• Here, two integer objects with values 1 and 2 are assigned
to variables a and b respectively, and one string object with
the value “lakshman" is assigned to the variable c.
KEYWORDS
• The following list shows the Python keywords. These are reserved
words and you cannot use them as constant or variable or any
other identifier names. All the Python keywords contain lowercase
letters only.
INPUT Function
• To get input from the user you can use the
input function.
• When the input function is called the program
stops running the program, prompts the user
to enter something at the keyboard Python
provides the function input().
• input has an optional parameter, which is the
prompt string.
OUTPUT function:
We use the print() function or print keyword to output
data to the standard output device (screen). This
function prints the object/string written in function.
The actual syntax of the print() function is
print(*objects, sep=' ', end='n', file=sys.stdout,
flush=False)
Here, objects is the value(s) to be printed.
The sep separator is used between the values. It
defaults into a space character. After all values are
printed, end is printed. It defaults into a new line ( n ).
Python programming language introduction unit
Indentation
• Like c or c++ ,there are no { , } in python.
• Python blocks are divided based on
indentation.
• A code block (body of a function, loop etc.) starts with indentation
and ends with the first unindented line. The amount of indentation
is up to you, but it must be consistent throughout that block.
Python programming language introduction unit

More Related Content

Similar to Python programming language introduction unit (20)

python programminig and introduction.pptx
python programminig and introduction.pptxpython programminig and introduction.pptx
python programminig and introduction.pptx
urvashipundir04
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
R.h. Himel
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
Arpittripathi45
 
Python basics
Python basicsPython basics
Python basics
ssuser4e32df
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
AyushDutta32
 
Chapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programmingChapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programming
biniyamtiktok
 
Python is a high-level, interpreted programming language that emphasizes read...
Python is a high-level, interpreted programming language that emphasizes read...Python is a high-level, interpreted programming language that emphasizes read...
Python is a high-level, interpreted programming language that emphasizes read...
bikomaster9459
 
Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...
bikomaster9459
 
Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...
bikomaster9459
 
Python Class 1
Python Class 1Python Class 1
Python Class 1
arijit banerjee
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Introduction python
Introduction pythonIntroduction python
Introduction python
Jumbo Techno e_Learning
 
introduction to python in computer graphics.pptx
introduction to python in computer graphics.pptxintroduction to python in computer graphics.pptx
introduction to python in computer graphics.pptx
urvashipundir04
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Python Online From EasyLearning Guru
Python Online From EasyLearning GuruPython Online From EasyLearning Guru
Python Online From EasyLearning Guru
KCC Software Ltd. & Easylearning.guru
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
python programminig and introduction.pptx
python programminig and introduction.pptxpython programminig and introduction.pptx
python programminig and introduction.pptx
urvashipundir04
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
R.h. Himel
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
Arpittripathi45
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
AyushDutta32
 
Chapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programmingChapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programming
biniyamtiktok
 
Python is a high-level, interpreted programming language that emphasizes read...
Python is a high-level, interpreted programming language that emphasizes read...Python is a high-level, interpreted programming language that emphasizes read...
Python is a high-level, interpreted programming language that emphasizes read...
bikomaster9459
 
Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...
bikomaster9459
 
Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...Python is a high-level, interpreted programming language known for its simpli...
Python is a high-level, interpreted programming language known for its simpli...
bikomaster9459
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
introduction to python in computer graphics.pptx
introduction to python in computer graphics.pptxintroduction to python in computer graphics.pptx
introduction to python in computer graphics.pptx
urvashipundir04
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 

More from michaelaaron25322 (14)

computer-system-architecture-morris-mano-220720124304-fefd641d.ppt
computer-system-architecture-morris-mano-220720124304-fefd641d.pptcomputer-system-architecture-morris-mano-220720124304-fefd641d.ppt
computer-system-architecture-morris-mano-220720124304-fefd641d.ppt
michaelaaron25322
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
memory Organization in computer organization
memory Organization in computer organizationmemory Organization in computer organization
memory Organization in computer organization
michaelaaron25322
 
EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...
michaelaaron25322
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
michaelaaron25322
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
Unit-II AES Algorithm which is used machine learning
Unit-II AES Algorithm which is used machine learningUnit-II AES Algorithm which is used machine learning
Unit-II AES Algorithm which is used machine learning
michaelaaron25322
 
UNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learningUNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learning
michaelaaron25322
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPA
michaelaaron25322
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
michaelaaron25322
 
mean stack
mean stackmean stack
mean stack
michaelaaron25322
 
karnaughmaprev1-130728135103-phpapp01.ppt
karnaughmaprev1-130728135103-phpapp01.pptkarnaughmaprev1-130728135103-phpapp01.ppt
karnaughmaprev1-130728135103-phpapp01.ppt
michaelaaron25322
 
booleanalgebra-140914001141-phpapp01 (1).ppt
booleanalgebra-140914001141-phpapp01 (1).pptbooleanalgebra-140914001141-phpapp01 (1).ppt
booleanalgebra-140914001141-phpapp01 (1).ppt
michaelaaron25322
 
mst_unit1.pptx
mst_unit1.pptxmst_unit1.pptx
mst_unit1.pptx
michaelaaron25322
 
computer-system-architecture-morris-mano-220720124304-fefd641d.ppt
computer-system-architecture-morris-mano-220720124304-fefd641d.pptcomputer-system-architecture-morris-mano-220720124304-fefd641d.ppt
computer-system-architecture-morris-mano-220720124304-fefd641d.ppt
michaelaaron25322
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
memory Organization in computer organization
memory Organization in computer organizationmemory Organization in computer organization
memory Organization in computer organization
michaelaaron25322
 
EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...EST is a software architectural style that was created to guide the design an...
EST is a software architectural style that was created to guide the design an...
michaelaaron25322
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
michaelaaron25322
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
Unit-II AES Algorithm which is used machine learning
Unit-II AES Algorithm which is used machine learningUnit-II AES Algorithm which is used machine learning
Unit-II AES Algorithm which is used machine learning
michaelaaron25322
 
UNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learningUNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learning
michaelaaron25322
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPA
michaelaaron25322
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
michaelaaron25322
 
karnaughmaprev1-130728135103-phpapp01.ppt
karnaughmaprev1-130728135103-phpapp01.pptkarnaughmaprev1-130728135103-phpapp01.ppt
karnaughmaprev1-130728135103-phpapp01.ppt
michaelaaron25322
 
booleanalgebra-140914001141-phpapp01 (1).ppt
booleanalgebra-140914001141-phpapp01 (1).pptbooleanalgebra-140914001141-phpapp01 (1).ppt
booleanalgebra-140914001141-phpapp01 (1).ppt
michaelaaron25322
 
Ad

Recently uploaded (20)

IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghjfHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
yadavshivank2006
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Artificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowyArtificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowy
dominikamizerska1
 
22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank
Guru Nanak Technical Institutions
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
Research_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptxResearch_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptx
niranjancse
 
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
ijfcstjournal
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
May 2025: Top 10 Read Articles Advanced Information Technology
May 2025: Top 10 Read Articles Advanced Information TechnologyMay 2025: Top 10 Read Articles Advanced Information Technology
May 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
Structure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS pptStructure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS ppt
Wahajch
 
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
kjim477n
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptxWeek 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghjfHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
fHUINhKG5lM1WBBk608.pptxfhjjhhjffhiuhhghj
yadavshivank2006
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Artificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowyArtificial Power 2025 raport krajobrazowy
Artificial Power 2025 raport krajobrazowy
dominikamizerska1
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
Research_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptxResearch_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptx
niranjancse
 
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
ijfcstjournal
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
May 2025: Top 10 Read Articles Advanced Information Technology
May 2025: Top 10 Read Articles Advanced Information TechnologyMay 2025: Top 10 Read Articles Advanced Information Technology
May 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
Structure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS pptStructure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS ppt
Wahajch
 
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
kjim477n
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptxWeek 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
Ad

Python programming language introduction unit

  • 1. Python Programming UNIT I Introduction: History of Python, Need of Python Programming, Applications, Basics of PythonProgramming Using the REPL(Shell), Running Python Scripts, Variables, Assignment, Keywords, Input-Output,Indentation.
  • 2. python •Python was developed by Guido van Rossum in the late eighties and early nineties at the 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, SmallTalk, Unix shell, and other scripting languages •At the time when he began implementing Python, Guido van Rossum was also reading the published scripts from "Monty Python's Flying Circus" (a BBC comedy series from the seventies, in the unlikely case you didn't know). It occurred to him that he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python.
  • 8. Python • Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable
  • 9. Need of Python Programming • 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.
  • 10. Need of Python Programming Interactive Mode: Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
  • 11. Need of Python Programming 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.
  • 12. Need of Python Programming • 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.
  • 13. Need of Python Programming • Scalable: Python provides a better structure and support for large programs than shell scripting.
  • 14. Need of Python Programming • Software quality Python code is designed to be readable, and hence reusable and maintainable— much more so than traditional scripting languages. The uniformity of Python code makes it easy to understand, even if you did not write it.
  • 15. Need of Python Programming Developer productivity Python boosts developer productivity many times beyond compiled or statically typed languages such as C, C++, and Java. Python code is typically one-third to less to debug, and less to maintain after the fact. Python programs also run immediately, without the lengthy compile and link steps required by some other tools
  • 16. Need of Python Programming • Support libraries Python comes with a large collection of prebuilt and portable functionality, known as the standard library. This library supports an array of application- level programming tasks, from text pattern matching to network scripting.
  • 17. Need of Python Programming It's Object-Oriented Python is an object- oriented language, from the ground up. Its class model supports advanced notions such as polymorphism, operator overloading, and multiple inheritance
  • 18. Need of Python Programming • It's Free Python is freeware—Its open source software. Download and use it.
  • 19. Need of Python Programming • It's Portable Python is written in portable ANSI C, and compiles and runs on virtually every major platform in use today. For example, it runs on UNIX systems, Linux, MS-DOS, MS-Windows (95, 98, NT), Macintosh, Amiga, Be-OS, OS/2, VMS, QNX, and more
  • 20. Need of Python Programming • It's Powerful From a features perspective, Python is something of a hybrid. Its tool set places it between traditional scripting languages (such as Tcl, Scheme, and Perl), and systems languages (such as C, C++, and Java).
  • 21. Need of Python Programming Automatic memory management Python automatically allocates and reclaims ("garbage collects") objects when no longer used, and most grow and shrink on demand.
  • 22. Need of Python Programming It's Easy to Use simplicity make programming more fun than work. To run a Python program, you simply type it and run it. There are no intermediate compile and link steps (as when using languages such as C or C++). It's Easy to Learn Compared to other programming languages, the core Python language is amazingly easy to learn.
  • 23. Need of Python Programming Internet Scripting Python comes with standard Internet utility modules that allow Python programs to communicate over sockets, extract form information sent to a server-side CGI script, parse HTML, transfer files by FTP, process XML files, and much more.
  • 24. Need of Python Programming Database Programming Python provides a simple object-persistence system: it allows programs to easily save and restore entire Python objects to files. For more traditional database demands, there are Python interfaces to Sybase, Oracle, Informix, ODBC, and more.
  • 25. Need of Python Programming • Image Processing, AI, Distributed Objects, Etc. • Python is commonly applied in more domains than can be mentioned here. • For instance, image processing for Python is implemented as a set of library components implemented in a compiled language such as C, along with a Python frontend layer on top used to configure and launch the compiled components. • Machine Learning,AI,IOT….
  • 26. Who Uses Python Today? • Google makes extensive use of Python in its web search systems. • The popular YouTube video sharing service is largely written in Python. • The Raspberry Pi single-board computer promotes Python as its educational language. • The widespread BitTorrent peer-to-peer file sharing system began its life as a Python program. • Google‘s App Engine web development framework uses Python as an application language. • Maya, a powerful integrated 3D modeling and animation system, provides a Python scripting API. • Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing. • NASA, Los Alamos, Fermilab, JPL, and others use Python for scientific programming tasks. • And many more……………….
  • 27. The Python Virtual Machine: • Once your program has been compiled to byte code (or the byte code has been loaded from existing .pyc file), it is shipped off for execution to something generally known as the python virtual machine (PVM).
  • 28. Applications of Python: • Systems Programming • GUIs • Internet Scripting • Database Programming • Rapid Prototyping • Numeric and Scientific Programming • …………
  • 29. Python’s Technical Strengths? • It‘s Object-Oriented and Functional • It‘s Free • It‘s Portable • It‘s Powerful • It‘s Mixable • It‘s Relatively Easy to Use • It‘s Relatively Easy to Learn
  • 31. Installation in ubuntu • commands: 1)cd /usr/src sudo wget 2)https://www.python.org/ftp/python/3.7.3/Py thon-3.7.3.tgz 3)sudo tar xzf Python-3.7.3.tgz 4)cd Python-3.7.3
  • 32. Running Python: Running Python Interpreter: Python comes with an interactive interpreter. When you type python in your shell or command prompt, the python interpreter becomes active with a >>> prompt and waits for your commands.
  • 33. Running Python: Running Python Scripts in IDLE: •Goto File menu click on New File (CTRL+N) and write the code and save add.py a=input("Enter a value ") b=input("Enter b value ") c=a+b print "The sum is",c •And run the program by pressing F5 or Run Run Module.
  • 34. Running python scripts in Command Prompt: Before going to run we have to check the PATH in environment variables. Open your text editor, type the following text and save it as hello.py. print "hello" And run this program by calling python hello.py. Make sure you change to the directory where you saved the file before doing it. Running Python:
  • 35. Variables Variables in a computer program are similar to buckets where information can be maintained
  • 36. Python Variables • Variables are nothing but reserved memory locations to store values. when you create a variable you reserve some space in memory. • Variables are containers for storing data values. • Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals or characters in these variables
  • 37. int x; float y; x=10 y=20.5 Variables x=10 y=20.5 C/C++ python x is automatically treated as int because 10 is integer value y is automatically Treated as float because 20.5 is float value x is declared as integer y is declared as float In Python,there is no need to declare a variable.A variable is created the moment you first assign a value to it
  • 38. Variable Names • A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables: • A variable name must start with a letter or the underscore character • A variable name cannot start with a number • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) • Variable names are case-sensitive (age, Age and AGE are three different variables)
  • 39. Assigning Values to Variables • Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables. • The operand to the left of the = operator is the name of the variable and the operand to the right of the = operator is the value stored in the variable.
  • 41. Multiple Assignments to variables • Python allows you to assign a single value to several variables simultaneously. • For example – • a = b = c = 1 • Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables. • For example – • a, b, c = 1, 2.5, ”lakshman” • Here, two integer objects with values 1 and 2 are assigned to variables a and b respectively, and one string object with the value “lakshman" is assigned to the variable c.
  • 42. KEYWORDS • The following list shows the Python keywords. These are reserved words and you cannot use them as constant or variable or any other identifier names. All the Python keywords contain lowercase letters only.
  • 43. INPUT Function • To get input from the user you can use the input function. • When the input function is called the program stops running the program, prompts the user to enter something at the keyboard Python provides the function input(). • input has an optional parameter, which is the prompt string.
  • 44. OUTPUT function: We use the print() function or print keyword to output data to the standard output device (screen). This function prints the object/string written in function. The actual syntax of the print() function is print(*objects, sep=' ', end='n', file=sys.stdout, flush=False) Here, objects is the value(s) to be printed. The sep separator is used between the values. It defaults into a space character. After all values are printed, end is printed. It defaults into a new line ( n ).
  • 46. Indentation • Like c or c++ ,there are no { , } in python. • Python blocks are divided based on indentation. • A code block (body of a function, loop etc.) starts with indentation and ends with the first unindented line. The amount of indentation is up to you, but it must be consistent throughout that block.