SlideShare ist ein Scribd-Unternehmen logo
Introduction to
Python
Jincy M Nelson
THRS
PYTHON
• A programming language developed
by Guido Van Rossum in feb-1991.
• Named after a comedy show namely
‘Monty Python’s Flying Circus’.
• It is based on ABC language.
• It is an open source language.
Features of Python
 It is an pen source, so it can be
modified and redistributed.
 Uses a few keywords and clear
,simply English like structure.
 Can run on variety of platforms.
 Support procedure oriented as well as
object oriented programming.
Features of Python
 It support Graphical user interface.
 It is compatible with C,C++ languages
etc.
 Used in game development, data
base application, web application ,
Artificial Intelligence.
 Lesser time required to learn Pyhton
as it has simple and concise code.
Features of Python
Distinguish between input, output and
error message by different colour
code.
Has large set of libraries with various
module functions.
Has automatic memory management.
Provide interface to all major
databases.
Applications of Python
• Amazon uses python to analyse customer’s
buying habits and search patterns.
• Facebook uses python to process images.
• Google uses python in search system.
• NASA uses python for scientific
programming tasks.
• Python is used in AI systems.
Python Character Set:
• A set of Valid characters that a language can recognize.
• A character set includes:
Letters : A-Z , a-z.
Digits : 0-9
Special Symbols :Space + -*/**(){}[]//!= ==<,>.’’ “”;:%!
White spaces : Blank space ,tabs carriage return ,new
line , form feed.
Other Characters : process all ASCII
Variable
• Has a name
• Capable of storing values of certain
data type.
• Provide temporary storage.
Variable naming conventions
• Variable names are case sensitive.
• Keywords or words with special meanings
should not be used as variables.
• Variable names should be short and
meaningful.
• All variable names should begin with a letter
or underscore(_).
• Variable names may contain numbers,
underscore,.
• no space or special character allowed
Keywords
• Keywords are the words that convey a
special meaning to the language
compiler/interpreter.
• These are reserved for special
purpose.
• Must not be used as normal variables.
• Eg: True, False , if, return , try, elif ,
and ,while, None ,with ,range ,break ,
for ,in ,or
Data Types
• Data types states the way the values of
that type are stored .
• The operations can be done on that
type and the range for that type.
• Different types of data requires different
amount of memory for storage.
• Data can be manipulated through
specific data types.
Standard Data Types
• Numbers
• String
• List
• Tuple
• Dictionary
Number
• Number data type is used to store
numerical values.
• Python support three numerical data
types.
• Integer: eg a=2
• Float: eg: a=2.766
• Complex Numbers: a=17+9b
String
• An order of set of characters closed
in a single or double quotation marks.
• Eg: str1=‘Hello’
• wrd=“Hello”
List
• List is a collection of comma separated
values within square bracket.
• Values in the list can be modified.
• The values in the list are called
elements.
• It is mutable.
• Elements in the list need not be of
same type.
Eg:
• List1=[1,56,84,5]
• List2=[45,98,48,65,0,23]
• List3=[‘anna’,’aby’,’riya’,’diya’]
Tuple
• A tuple is a sequence of comma
separated values . Values in tuple
cannot be changed.
• It is immutable.
• The values in the tuple are called as
elements.
• Elements in the list need not be of
same type.
Eg:
tup1=(‘Sunday’,’Monday’,10,20)
tup2=(10,20,30)
tup3=(‘a’,’b’,’c’,’d’)
Dictionary
• An unordered collection of items where
each item is a key: value pair
• Each key is separated from its value
by a colon (:) .
• The entire dictionary is enclosed within
curly braces {}.
• Keys are unique within dictionary while
the values may not be.
• Eg:
• Dic1={‘R’:RAINY, ‘S’:SUMMER, ‘W’:
WINTER, ‘A’=AUTUMN}
Boolean data type
• The Boolean data type is either TRUE
or FALSE
• In python, Boolean variables are
defined by either True or False.
• The first letter of True and False must
be in upper case . Lower case returns
error
Eg:
>>> a=True
>>> type(a)
<class 'bool'>
>>> a=True
>>> b=False
>>> a or b
True
>>> a and b
False
>>> not a
False
>>> a==b
False
>>> a!=b
True
>>>
Data Type Conversion
• The process of converting the value of
one data type to another data type is
called type conversion.
• There are two types of conversion
• Implicit type conversion
• Explicit type conversion
Implicit type conversion
• In this python automatically convert
one data type to another.
• This process doesn’t need any user
involvement.
Program:
a=50
b=45.5
print('Type of a:',type(a))
print('Type of b:',type(b))
c=a+b
print('Type of c:',type(c))
Output:
Type of a: <class 'int'>
Type of b: <class 'float'>
Type of c: <class 'float'>
Explicit type conversion
• User convert the data type of an object
to the required data type.
• We use predefined functions like int(),
float(),complex(), bool(), str(), tuple(),
list() ,dict() etc to perform explicit type
conversion.
• This type conversion is also known as
type casting.
Input
a=100
b=20.50
c='567'
print('Variable a converted into string:',str(a))
print('Variable a converted into float:',float(a))
print('Variable b converted into integer:',int(b))
print('Variable b converted into string:',str(b))
print('Variable c converted into integer:',int(c))
print('Variable c converted into float:',float(c))
print('Variable a converted into list:',list(c))
OUTPUT
Variable a converted into string: 100
Variable a converted into float: 100.0
Variable b converted into integer: 20
Variable b converted into string: 20.5
Variable c converted into integer: 567
Variable c converted into float: 567.0
Variable a converted into list: ['5', '6', '7']
Operators
• Are special symbols which represent
computation.
• Values or variables are called
oparands .
• The operator is applied on operands,
thus form expression.
Precedence of Arithmetic
operators
Relational Operators
Assigning value to variable
User input
• The values inserted by the user while executing a program are
fetched and stored in the variable using the input() function.
User output
• The print statement is used to display
the value of a variable.
• If an expression is given with the print
statement ,it first evaluate the
expression and then print it.
• To print more than one item on a
single line comma (,) can be used.
User output
comments
• A comment in Python starts with the hash
character, # , and extends to the end of the
physical line.
• 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:
• Example
• #This is a comment
print("Hello, World!")
• Comments can be placed at the end of a line, and
Python will ignore the rest of the line:
• Example
• print("Hello, World!") #This is a comment
•
• A comment does not have to be text
that explains the code, it can also be
used to prevent Python from executing
code:
• Example
• #print("Hello, World!")
print("Cheers, Mate!")
Multi Line Comments
• Python does not really have a syntax
for multi line comments.
• To add a multiline comment you could
insert a # for each line:
• Example
• #This is a comment
#written in
#more than just one line
print("Hello, World!")
• Or, not quite as intended, you can use a
multiline string.
• Since Python will ignore string literals that are
not assigned to a variable, you can add a
multiline string (triple quotes) in your code, and
place your comment inside it:
• Example
• """
This is a comment
written in
more than just one line
"""
print("Hello, World!")
Indentation In Python
• Indentation refers to the spaces at the
beginning of a code line.
• Python uses indentation to indicate a block
of code.
• Python will give you an error if you skip the
indentation:
• You have to use the same number of
spaces in the same block of code, otherwise
Python will give you an error:
Chapter7-Introduction to Python.pptx

Weitere ähnliche Inhalte

Ähnlich wie Chapter7-Introduction to Python.pptx

Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptxmahendranaik18
 
c programming 2nd chapter pdf.PPT
c programming 2nd chapter pdf.PPTc programming 2nd chapter pdf.PPT
c programming 2nd chapter pdf.PPTKauserJahan6
 
Introduction to Problem Solving C Programming
Introduction to Problem Solving C ProgrammingIntroduction to Problem Solving C Programming
Introduction to Problem Solving C ProgrammingRKarthickCSEKIOT
 
A File is a collection of data stored in the secondary memory. So far data wa...
A File is a collection of data stored in the secondary memory. So far data wa...A File is a collection of data stored in the secondary memory. So far data wa...
A File is a collection of data stored in the secondary memory. So far data wa...bhargavi804095
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptxdeivanayagamramachan
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptxsangeeta borde
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overviewTAlha MAlik
 
modul-python-part1.pptx
modul-python-part1.pptxmodul-python-part1.pptx
modul-python-part1.pptxYusuf Ayuba
 
01 Java Language And OOP PART I
01 Java Language And OOP PART I01 Java Language And OOP PART I
01 Java Language And OOP PART IHari Christian
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptxssuserb1a18d
 
5variables in c#
5variables in c#5variables in c#
5variables in c#Sireesh K
 

Ähnlich wie Chapter7-Introduction to Python.pptx (20)

Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptx
 
Chapter02.PPT
Chapter02.PPTChapter02.PPT
Chapter02.PPT
 
c programming 2nd chapter pdf.PPT
c programming 2nd chapter pdf.PPTc programming 2nd chapter pdf.PPT
c programming 2nd chapter pdf.PPT
 
Introduction to Problem Solving C Programming
Introduction to Problem Solving C ProgrammingIntroduction to Problem Solving C Programming
Introduction to Problem Solving C Programming
 
A File is a collection of data stored in the secondary memory. So far data wa...
A File is a collection of data stored in the secondary memory. So far data wa...A File is a collection of data stored in the secondary memory. So far data wa...
A File is a collection of data stored in the secondary memory. So far data wa...
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx
 
Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
 
python_class.pptx
python_class.pptxpython_class.pptx
python_class.pptx
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
 
modul-python-part1.pptx
modul-python-part1.pptxmodul-python-part1.pptx
modul-python-part1.pptx
 
01 Java Language And OOP PART I
01 Java Language And OOP PART I01 Java Language And OOP PART I
01 Java Language And OOP PART I
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
 
C language
C languageC language
C language
 
unit1 python.pptx
unit1 python.pptxunit1 python.pptx
unit1 python.pptx
 
06.pptx
06.pptx06.pptx
06.pptx
 
Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 

Kürzlich hochgeladen

Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...
Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...
Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...GQ Research
 
A Community health , health for prisoners
A Community health  , health for prisonersA Community health  , health for prisoners
A Community health , health for prisonersAhmed Elmi
 
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptx
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptxASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptx
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptxAnushriSrivastav
 
Myopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptxMyopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptxRitonDeb1
 
HEAT WAVE presented by priya bhojwani..pptx
HEAT WAVE presented by priya bhojwani..pptxHEAT WAVE presented by priya bhojwani..pptx
HEAT WAVE presented by priya bhojwani..pptxpriyabhojwani1200
 
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptx
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptxBOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptx
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptxAnushriSrivastav
 
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur aunty1x1
 
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤aunty1x2
 
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...aunty1x1
 
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...aunty1x1
 
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...aunty1x1
 
Importance of Diet on Dental Health.docx
Importance of Diet on Dental Health.docxImportance of Diet on Dental Health.docx
Importance of Diet on Dental Health.docxSachin Mittal
 
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safe
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model SafeJaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safe
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safeaunty1x1
 
Valle Egypt Illustrates Consequences of Financial Elder Abuse
Valle Egypt Illustrates Consequences of Financial Elder AbuseValle Egypt Illustrates Consequences of Financial Elder Abuse
Valle Egypt Illustrates Consequences of Financial Elder AbuseKristin Hetzer
 
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts by ✔️🍑💃Hotel #cALL #gIRLS...
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts  by ✔️🍑💃Hotel #cALL #gIRLS...💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts  by ✔️🍑💃Hotel #cALL #gIRLS...
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts by ✔️🍑💃Hotel #cALL #gIRLS...aunty1x1
 
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdf
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdfCHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdf
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdfSachin Sharma
 
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptx
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptxUrinary Elimination BY ANUSHRI SRIVASTAVA.pptx
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptxAnushriSrivastav
 
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...saimasadaf14
 
Virtual Health Platforms_ Revolutionizing Patient Care.pdf
Virtual Health Platforms_ Revolutionizing Patient Care.pdfVirtual Health Platforms_ Revolutionizing Patient Care.pdf
Virtual Health Platforms_ Revolutionizing Patient Care.pdfsmartcare
 
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...aunty1x2
 

Kürzlich hochgeladen (20)

Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...
Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...
Healthcare Companion Robots: Key Features and Functionalities, Benefits, Chal...
 
A Community health , health for prisoners
A Community health  , health for prisonersA Community health  , health for prisoners
A Community health , health for prisoners
 
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptx
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptxASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptx
ASSISTING WITH THE USE OF URINAL BY ANUSHRI SRIVASTAVA.pptx
 
Myopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptxMyopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptx
 
HEAT WAVE presented by priya bhojwani..pptx
HEAT WAVE presented by priya bhojwani..pptxHEAT WAVE presented by priya bhojwani..pptx
HEAT WAVE presented by priya bhojwani..pptx
 
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptx
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptxBOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptx
BOWEL ELIMINATION BY ANUSHRI SRIVASTAVA.pptx
 
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur
Jaipur #ℂall #gIRLS Oyo Hotel 89O1183OO2 #ℂall #gIRL in Jaipur
 
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
 
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...
Notify ME 89O1183OO2 #cALL# #gIRLS# In Chhattisgarh By Chhattisgarh #ℂall #gI...
 
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...
Contact mE 👙👨‍❤️‍👨 (89O1183OO2) 💘ℂall Girls In MOHALI By MOHALI 💘ESCORTS GIRL...
 
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...
Call Girls in Jaipur (Rajasthan) call me [🔝89011-83002🔝] Escort In Jaipur ℂal...
 
Importance of Diet on Dental Health.docx
Importance of Diet on Dental Health.docxImportance of Diet on Dental Health.docx
Importance of Diet on Dental Health.docx
 
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safe
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model SafeJaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safe
Jaipur @ℂall @Girls ꧁❤8901183002❤꧂@ℂall @Girls Service Vip Top Model Safe
 
Valle Egypt Illustrates Consequences of Financial Elder Abuse
Valle Egypt Illustrates Consequences of Financial Elder AbuseValle Egypt Illustrates Consequences of Financial Elder Abuse
Valle Egypt Illustrates Consequences of Financial Elder Abuse
 
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts by ✔️🍑💃Hotel #cALL #gIRLS...
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts  by ✔️🍑💃Hotel #cALL #gIRLS...💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts  by ✔️🍑💃Hotel #cALL #gIRLS...
💃Joint ❤89011-83002❤ #ℂALL #gIRLS Ludhiana Escorts by ✔️🍑💃Hotel #cALL #gIRLS...
 
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdf
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdfCHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdf
CHAPTER 1 SEMESTER V - ROLE OF PEADIATRIC NURSE.pdf
 
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptx
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptxUrinary Elimination BY ANUSHRI SRIVASTAVA.pptx
Urinary Elimination BY ANUSHRI SRIVASTAVA.pptx
 
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...
Jesse Jhaj: Building Relationships with Patients as a Doctor or Healthcare Wo...
 
Virtual Health Platforms_ Revolutionizing Patient Care.pdf
Virtual Health Platforms_ Revolutionizing Patient Care.pdfVirtual Health Platforms_ Revolutionizing Patient Care.pdf
Virtual Health Platforms_ Revolutionizing Patient Care.pdf
 
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
 

Chapter7-Introduction to Python.pptx

  • 2. PYTHON • A programming language developed by Guido Van Rossum in feb-1991. • Named after a comedy show namely ‘Monty Python’s Flying Circus’. • It is based on ABC language. • It is an open source language.
  • 3. Features of Python  It is an pen source, so it can be modified and redistributed.  Uses a few keywords and clear ,simply English like structure.  Can run on variety of platforms.  Support procedure oriented as well as object oriented programming.
  • 4. Features of Python  It support Graphical user interface.  It is compatible with C,C++ languages etc.  Used in game development, data base application, web application , Artificial Intelligence.  Lesser time required to learn Pyhton as it has simple and concise code.
  • 5. Features of Python Distinguish between input, output and error message by different colour code. Has large set of libraries with various module functions. Has automatic memory management. Provide interface to all major databases.
  • 6. Applications of Python • Amazon uses python to analyse customer’s buying habits and search patterns. • Facebook uses python to process images. • Google uses python in search system. • NASA uses python for scientific programming tasks. • Python is used in AI systems.
  • 7. Python Character Set: • A set of Valid characters that a language can recognize. • A character set includes: Letters : A-Z , a-z. Digits : 0-9 Special Symbols :Space + -*/**(){}[]//!= ==<,>.’’ “”;:%! White spaces : Blank space ,tabs carriage return ,new line , form feed. Other Characters : process all ASCII
  • 8. Variable • Has a name • Capable of storing values of certain data type. • Provide temporary storage.
  • 9. Variable naming conventions • Variable names are case sensitive. • Keywords or words with special meanings should not be used as variables. • Variable names should be short and meaningful. • All variable names should begin with a letter or underscore(_). • Variable names may contain numbers, underscore,. • no space or special character allowed
  • 10. Keywords • Keywords are the words that convey a special meaning to the language compiler/interpreter. • These are reserved for special purpose. • Must not be used as normal variables. • Eg: True, False , if, return , try, elif , and ,while, None ,with ,range ,break , for ,in ,or
  • 11. Data Types • Data types states the way the values of that type are stored . • The operations can be done on that type and the range for that type. • Different types of data requires different amount of memory for storage. • Data can be manipulated through specific data types.
  • 12. Standard Data Types • Numbers • String • List • Tuple • Dictionary
  • 13. Number • Number data type is used to store numerical values. • Python support three numerical data types. • Integer: eg a=2 • Float: eg: a=2.766 • Complex Numbers: a=17+9b
  • 14. String • An order of set of characters closed in a single or double quotation marks. • Eg: str1=‘Hello’ • wrd=“Hello”
  • 15. List • List is a collection of comma separated values within square bracket. • Values in the list can be modified. • The values in the list are called elements. • It is mutable. • Elements in the list need not be of same type.
  • 16. Eg: • List1=[1,56,84,5] • List2=[45,98,48,65,0,23] • List3=[‘anna’,’aby’,’riya’,’diya’]
  • 17. Tuple • A tuple is a sequence of comma separated values . Values in tuple cannot be changed. • It is immutable. • The values in the tuple are called as elements. • Elements in the list need not be of same type.
  • 19. Dictionary • An unordered collection of items where each item is a key: value pair • Each key is separated from its value by a colon (:) . • The entire dictionary is enclosed within curly braces {}. • Keys are unique within dictionary while the values may not be.
  • 20. • Eg: • Dic1={‘R’:RAINY, ‘S’:SUMMER, ‘W’: WINTER, ‘A’=AUTUMN}
  • 21. Boolean data type • The Boolean data type is either TRUE or FALSE • In python, Boolean variables are defined by either True or False. • The first letter of True and False must be in upper case . Lower case returns error
  • 22. Eg: >>> a=True >>> type(a) <class 'bool'> >>> a=True >>> b=False >>> a or b True >>> a and b False >>> not a False >>> a==b False >>> a!=b True >>>
  • 23. Data Type Conversion • The process of converting the value of one data type to another data type is called type conversion. • There are two types of conversion • Implicit type conversion • Explicit type conversion
  • 24. Implicit type conversion • In this python automatically convert one data type to another. • This process doesn’t need any user involvement.
  • 25. Program: a=50 b=45.5 print('Type of a:',type(a)) print('Type of b:',type(b)) c=a+b print('Type of c:',type(c)) Output: Type of a: <class 'int'> Type of b: <class 'float'> Type of c: <class 'float'>
  • 26. Explicit type conversion • User convert the data type of an object to the required data type. • We use predefined functions like int(), float(),complex(), bool(), str(), tuple(), list() ,dict() etc to perform explicit type conversion. • This type conversion is also known as type casting.
  • 27. Input a=100 b=20.50 c='567' print('Variable a converted into string:',str(a)) print('Variable a converted into float:',float(a)) print('Variable b converted into integer:',int(b)) print('Variable b converted into string:',str(b)) print('Variable c converted into integer:',int(c)) print('Variable c converted into float:',float(c)) print('Variable a converted into list:',list(c)) OUTPUT Variable a converted into string: 100 Variable a converted into float: 100.0 Variable b converted into integer: 20 Variable b converted into string: 20.5 Variable c converted into integer: 567 Variable c converted into float: 567.0 Variable a converted into list: ['5', '6', '7']
  • 28.
  • 29. Operators • Are special symbols which represent computation. • Values or variables are called oparands . • The operator is applied on operands, thus form expression.
  • 30.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. Assigning value to variable
  • 38. User input • The values inserted by the user while executing a program are fetched and stored in the variable using the input() function.
  • 39. User output • The print statement is used to display the value of a variable. • If an expression is given with the print statement ,it first evaluate the expression and then print it. • To print more than one item on a single line comma (,) can be used.
  • 41. comments • A comment in Python starts with the hash character, # , and extends to the end of the physical line. • 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.
  • 42. Creating a Comment • Comments starts with a #, and Python will ignore them: • Example • #This is a comment print("Hello, World!") • Comments can be placed at the end of a line, and Python will ignore the rest of the line: • Example • print("Hello, World!") #This is a comment •
  • 43. • A comment does not have to be text that explains the code, it can also be used to prevent Python from executing code: • Example • #print("Hello, World!") print("Cheers, Mate!")
  • 44. Multi Line Comments • Python does not really have a syntax for multi line comments. • To add a multiline comment you could insert a # for each line: • Example • #This is a comment #written in #more than just one line print("Hello, World!")
  • 45. • Or, not quite as intended, you can use a multiline string. • Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it: • Example • """ This is a comment written in more than just one line """ print("Hello, World!")
  • 46. Indentation In Python • Indentation refers to the spaces at the beginning of a code line. • Python uses indentation to indicate a block of code. • Python will give you an error if you skip the indentation: • You have to use the same number of spaces in the same block of code, otherwise Python will give you an error: