SlideShare a Scribd company logo
1 of 19
PYTHON
* FEATURES
&
* DATA TYPES
RESHMA.R
II MSc Bioinformatics
6-03-2017
INTRODUCTION
• Python is a widely used high-level programming language.
• general-purpose for programming.
• created by “Guido van Rossum” and first released in 1991.
• It is an interpreted language.
• It is easy to read more closer to user
• Read like English language.
Useful areas:
*Scripts *Web-site development
*Text processing *Scientific computing
*Education
FEATURES OF PYTHON:
• It is a dynamic type system
• Automatic memory management
• Support multiple programming including object-oriented, imperative,
functional programming and procedure styles.
• It has large and comprehensive standard library
Simple;
• it is simple language
• Reading good Python program feels almost like English (but very strict
English)
East to Learn;
• Python has an extraordinally simple syntax
Free and open source;
• Python is an example of a FLOSS(Free / Libra and Open Source Software)
• We can freely distribute the copies of the software.
High-level language;
• When you write programs in Python you never need to bother about low-
level details.
Portable;
• Python has been ported to many platforms,
• Python programs will work any platform without any changes,
ex; Linux, windows ect
Object Oriented;
• Python has very powerful but simple way of doing object oriented
programming
• Especially compared languages like C++ or Java
PYTHON DATATYPES
Python NUMBERS
• Numbers are created by numeric literals.
• Numeric objects are immutable,
• When an object is created its value cannot be changed.
• Python has three distinct numeric types:
INTEGERS-
i. Integers represent negative and positive integers without fractional parts,
ii. Integers can be of any length, it is only limited by the memory available
Character P Y T H O N
Index(from left) 0 1 2 3 4 5
Index(from right) -6 -5 -4 -3 -2 -1
FLOATING POINT -
i. floating point numbers represents negative and positive numbers with
fractional parts.
ii. It is accurate up to 15 decimal places.
iii. Integer and floating points are separated by decimal points.
ex: 1 is integer, 1.3 is floating point
COMPLEX NUMBERS:
i. Complex numbers have a real and imaginary part
ii. The form A+Bi where i is the imaginary number.
iii. Python supports complex numbers either by specifying the number in
(real + imagJ) or (real + imagj) form.
PYTHON LIST
• List is an ordered sequence of items,
• It is one of the most used data type in Python & is very flexible.
• All the item of the list do not need to be of the same type,
• Items are separated by ‘comma’ and enclosed with ‘brackets’
• List are Mutable.
• A list without any element is called an empty list.
• list indices start at 0.
• As positive integers are used to index from the left end and negative
integers are used to index from the right end, so every item of a list gives
two alternatives indices.
• Let create a color list with four items.
Item RED Blue Green Black
Index (from left) 0 1 2 3
Index (from right) -4 -3 -2 -1
>>> a= [1, 2.2, ‘PYTHON’]
• We can use slicing operators [ ] to extract an item or range of
item from a list
Ex;
• List are mutable, that mean value of the elements list can be
altered
Ex
>>> a = [ 5,10,15,20,25,30,35,40,45 ]
>>> a = [ 2 ]
15
>>> a [ 0 : 3 ]
5,10,15
>>> a [5 : ]
30,35,40,45
>>> a = [ 1, 2, 3 ]
>>> a [ 2 ] = 4
>>> a
[ 1, 2, 4 ]
PYTHON TUPLE
• Tuple is an ordered sequence of items same as list.
• A tuple is a series of comma-separated values (items or elements) between
parentheses.
• Tuples are immutable (i.e. you cannot change its content once created)
• The tuple indices start at 0.
• We can use the slicing operators [ ] to extract items but cannot change the
value.
Join tuple:
• We can join the two tuples
Ex
>>> a = ( 5, ‘Program’ , 1+3j )
>>> tup1 = ( 1, 2, 3 )
>>> tup2 = ( 4, 5, 6 )
>>> tup1 + tup2
1, 2, 3, 4, 5, 6
>>> tup1 * 2
1, 2, 3, 1, 2, 3
Count; number of times appearance (tup.count (x)
Index; position of the item or element (tup.index(x)
ex; Tup.count
>>> Animals.( ‘cow’, ‘dog’, ‘cat’, ‘monkey’, ‘tiger’, ‘cat ‘)
>>> Animals.count ( ‘cat ‘)
2
>>> Animals.count ( ‘donkey’ )
0
Tup.index
>>> Animals.index ( ‘cat’ )
2
>>> Animals.index ( ‘donkey’ )
error
PYTHON STRING
• String is sequence of Unicode characters.
• a string type object is a sequence (left-to- right order) of characters.
• Strings start and end with single or double quotes.
• Multi line string can be denoted using triple quotes,
• Python strings are Immutable.
• Single and double quoted strings are same and you can use a single quote
within a string when it is surrounded by double quote and vice versa.
• Like list ,tuple and slicing operator can be used with string.
Ex;
>>> a = “Hello Friends”
>>> a [ 4 ]
‘o’
>>> a [ 6 : 12 ]
‘Friends’
PYTHON SET;
• Set is an unordered collection of unique item.
• Set is defined by value and value separated by comma inside the braces { }
• Basic uses include dealing with set theory
• eliminating duplicate entries.
Ex;
>>> a = { 1, 2, 2, 3, 3, 3, 4 }
>>> a
{ 1, 2, 3 }
PYTHON DICTIONARY;
• Dictionary is an unordered collection of key and value pairs.
• It generally used when we have a huge amount of data,
• Dictionary are optimized for retrieving data
• We must know the key to retrieve the value
• In Python Dictionary are defined within curly braces{ }
• Each item being a pair in the form key : value
• The items in a dictionary are a comma-separated list of key:value pairs
where keys and values are Python data type.
>>> a = { 1 : ‘value’ , ‘key’ : 2 }
• Dictionary mutable type but we can change only value
• Key cannot repeated more then one value
• You can create an empty dictionary using empty curly braces
Ex;
>>> Fruits = { ‘orange’ : 2, ‘apple’ : 4, ‘banana’ : 5
>>> Fruits [ ‘ apple ‘ ] = 6
fruits = { ‘apple’ : 6 }
Conversion between data type
• We can convert between different data types by using different type
conversion functions like int( ), float( ), str( ) etc.
• Conversion from float to int
• Conversion to and from string must contain compatible values.
>>> float ( 5 )
5.0
>>> int ( 10. 6 )
10
>>> int (-10.6 )
-10
>>> float ( ‘ 2.5 ‘)
2.5
>>> str ( 25 )
‘ 25 ‘
• We can even convert one sequence into another
• To convert each dictionary, each element must be a pair.
>>> set ( [ 1, 2, 3 ] )
{ 1, 2, 3 }
>>> tuple ( { 5, 6, 7 } )
( 5, 6, 7 )
>>> list ( ‘hello’ )
[ ‘h’, ‘e’, ‘l’, ‘l’, ‘o’ ]
>>> dict ( [ [ 1, 2], [3, 4] ] )
{ 1 : 2, 3 : 4 }
Python

More Related Content

What's hot

Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in pythonsunilchute1
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with PythonSushant Mane
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming LanguageMansiSuthar3
 
Python lab basics
Python lab basicsPython lab basics
Python lab basicsAbi_Kasi
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPKamal Acharya
 
Python Collections
Python CollectionsPython Collections
Python Collectionssachingarg0
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data typeswati kushwaha
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| FundamentalsMohd Sajjad
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3Syed Farjad Zia Zaidi
 

What's hot (18)

Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in python
 
Standard data-types-in-py
Standard data-types-in-pyStandard data-types-in-py
Standard data-types-in-py
 
Python :variable types
Python :variable typesPython :variable types
Python :variable types
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with Python
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
Python lab basics
Python lab basicsPython lab basics
Python lab basics
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
 
Python Collections
Python CollectionsPython Collections
Python Collections
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 

Viewers also liked

Biotechnology and its application ppt, Grade 12 CBSE
Biotechnology and its application ppt, Grade 12 CBSEBiotechnology and its application ppt, Grade 12 CBSE
Biotechnology and its application ppt, Grade 12 CBSEblessiemary
 
Hybridoma technology and application for monoclonal antibodies
Hybridoma technology and application for monoclonal antibodiesHybridoma technology and application for monoclonal antibodies
Hybridoma technology and application for monoclonal antibodiesJagphool Chauhan
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 

Viewers also liked (6)

Biotechnology and its application ppt, Grade 12 CBSE
Biotechnology and its application ppt, Grade 12 CBSEBiotechnology and its application ppt, Grade 12 CBSE
Biotechnology and its application ppt, Grade 12 CBSE
 
Monoclonal antibody
Monoclonal antibodyMonoclonal antibody
Monoclonal antibody
 
Hybridoma technology and application for monoclonal antibodies
Hybridoma technology and application for monoclonal antibodiesHybridoma technology and application for monoclonal antibodies
Hybridoma technology and application for monoclonal antibodies
 
Gmo's ppt.......
Gmo's ppt.......Gmo's ppt.......
Gmo's ppt.......
 
Monoclonal antibody
Monoclonal antibodyMonoclonal antibody
Monoclonal antibody
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to Python

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
 
02 Python Data Structure.pptx
02 Python Data Structure.pptx02 Python Data Structure.pptx
02 Python Data Structure.pptxssuser88c564
 
Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptxmahendranaik18
 
1. python programming
1. python programming1. python programming
1. python programmingsreeLekha51
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxlemonchoos
 
introduction to python
 introduction to python introduction to python
introduction to pythonJincy Nelson
 
python presentation.pptx
python presentation.pptxpython presentation.pptx
python presentation.pptxNightTune44
 
Python data type
Python data typePython data type
Python data typeJaya Kumari
 
INTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptxINTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptxNimrahafzal1
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfMichpice
 

Similar to Python (20)

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
 
02 Python Data Structure.pptx
02 Python Data Structure.pptx02 Python Data Structure.pptx
02 Python Data Structure.pptx
 
tupple.pptx
tupple.pptxtupple.pptx
tupple.pptx
 
Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptx
 
pythondatatypes.pptx
pythondatatypes.pptxpythondatatypes.pptx
pythondatatypes.pptx
 
1. python programming
1. python programming1. python programming
1. python programming
 
ppt_pspp.pdf
ppt_pspp.pdfppt_pspp.pdf
ppt_pspp.pdf
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptx
 
introduction to python
 introduction to python introduction to python
introduction to python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
python presentation.pptx
python presentation.pptxpython presentation.pptx
python presentation.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python data type
Python data typePython data type
Python data type
 
unit1 python.pptx
unit1 python.pptxunit1 python.pptx
unit1 python.pptx
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
Data Types In Python.pptx
Data Types In Python.pptxData Types In Python.pptx
Data Types In Python.pptx
 
INTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptxINTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptx
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
 

Recently uploaded

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 

Recently uploaded (20)

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

Python

  • 1. PYTHON * FEATURES & * DATA TYPES RESHMA.R II MSc Bioinformatics 6-03-2017
  • 2. INTRODUCTION • Python is a widely used high-level programming language. • general-purpose for programming. • created by “Guido van Rossum” and first released in 1991. • It is an interpreted language. • It is easy to read more closer to user • Read like English language. Useful areas: *Scripts *Web-site development *Text processing *Scientific computing *Education
  • 3. FEATURES OF PYTHON: • It is a dynamic type system • Automatic memory management • Support multiple programming including object-oriented, imperative, functional programming and procedure styles. • It has large and comprehensive standard library Simple; • it is simple language • Reading good Python program feels almost like English (but very strict English) East to Learn; • Python has an extraordinally simple syntax
  • 4. Free and open source; • Python is an example of a FLOSS(Free / Libra and Open Source Software) • We can freely distribute the copies of the software. High-level language; • When you write programs in Python you never need to bother about low- level details. Portable; • Python has been ported to many platforms, • Python programs will work any platform without any changes, ex; Linux, windows ect Object Oriented; • Python has very powerful but simple way of doing object oriented programming • Especially compared languages like C++ or Java
  • 6. Python NUMBERS • Numbers are created by numeric literals. • Numeric objects are immutable, • When an object is created its value cannot be changed. • Python has three distinct numeric types: INTEGERS- i. Integers represent negative and positive integers without fractional parts, ii. Integers can be of any length, it is only limited by the memory available Character P Y T H O N Index(from left) 0 1 2 3 4 5 Index(from right) -6 -5 -4 -3 -2 -1
  • 7. FLOATING POINT - i. floating point numbers represents negative and positive numbers with fractional parts. ii. It is accurate up to 15 decimal places. iii. Integer and floating points are separated by decimal points. ex: 1 is integer, 1.3 is floating point
  • 8. COMPLEX NUMBERS: i. Complex numbers have a real and imaginary part ii. The form A+Bi where i is the imaginary number. iii. Python supports complex numbers either by specifying the number in (real + imagJ) or (real + imagj) form.
  • 9. PYTHON LIST • List is an ordered sequence of items, • It is one of the most used data type in Python & is very flexible. • All the item of the list do not need to be of the same type, • Items are separated by ‘comma’ and enclosed with ‘brackets’ • List are Mutable. • A list without any element is called an empty list. • list indices start at 0. • As positive integers are used to index from the left end and negative integers are used to index from the right end, so every item of a list gives two alternatives indices. • Let create a color list with four items. Item RED Blue Green Black Index (from left) 0 1 2 3 Index (from right) -4 -3 -2 -1 >>> a= [1, 2.2, ‘PYTHON’]
  • 10. • We can use slicing operators [ ] to extract an item or range of item from a list Ex; • List are mutable, that mean value of the elements list can be altered Ex >>> a = [ 5,10,15,20,25,30,35,40,45 ] >>> a = [ 2 ] 15 >>> a [ 0 : 3 ] 5,10,15 >>> a [5 : ] 30,35,40,45 >>> a = [ 1, 2, 3 ] >>> a [ 2 ] = 4 >>> a [ 1, 2, 4 ]
  • 11. PYTHON TUPLE • Tuple is an ordered sequence of items same as list. • A tuple is a series of comma-separated values (items or elements) between parentheses. • Tuples are immutable (i.e. you cannot change its content once created) • The tuple indices start at 0. • We can use the slicing operators [ ] to extract items but cannot change the value. Join tuple: • We can join the two tuples Ex >>> a = ( 5, ‘Program’ , 1+3j ) >>> tup1 = ( 1, 2, 3 ) >>> tup2 = ( 4, 5, 6 ) >>> tup1 + tup2 1, 2, 3, 4, 5, 6 >>> tup1 * 2 1, 2, 3, 1, 2, 3
  • 12. Count; number of times appearance (tup.count (x) Index; position of the item or element (tup.index(x) ex; Tup.count >>> Animals.( ‘cow’, ‘dog’, ‘cat’, ‘monkey’, ‘tiger’, ‘cat ‘) >>> Animals.count ( ‘cat ‘) 2 >>> Animals.count ( ‘donkey’ ) 0 Tup.index >>> Animals.index ( ‘cat’ ) 2 >>> Animals.index ( ‘donkey’ ) error
  • 13. PYTHON STRING • String is sequence of Unicode characters. • a string type object is a sequence (left-to- right order) of characters. • Strings start and end with single or double quotes. • Multi line string can be denoted using triple quotes, • Python strings are Immutable. • Single and double quoted strings are same and you can use a single quote within a string when it is surrounded by double quote and vice versa. • Like list ,tuple and slicing operator can be used with string. Ex; >>> a = “Hello Friends” >>> a [ 4 ] ‘o’ >>> a [ 6 : 12 ] ‘Friends’
  • 14. PYTHON SET; • Set is an unordered collection of unique item. • Set is defined by value and value separated by comma inside the braces { } • Basic uses include dealing with set theory • eliminating duplicate entries. Ex; >>> a = { 1, 2, 2, 3, 3, 3, 4 } >>> a { 1, 2, 3 }
  • 15. PYTHON DICTIONARY; • Dictionary is an unordered collection of key and value pairs. • It generally used when we have a huge amount of data, • Dictionary are optimized for retrieving data • We must know the key to retrieve the value • In Python Dictionary are defined within curly braces{ } • Each item being a pair in the form key : value • The items in a dictionary are a comma-separated list of key:value pairs where keys and values are Python data type. >>> a = { 1 : ‘value’ , ‘key’ : 2 }
  • 16. • Dictionary mutable type but we can change only value • Key cannot repeated more then one value • You can create an empty dictionary using empty curly braces Ex; >>> Fruits = { ‘orange’ : 2, ‘apple’ : 4, ‘banana’ : 5 >>> Fruits [ ‘ apple ‘ ] = 6 fruits = { ‘apple’ : 6 }
  • 17. Conversion between data type • We can convert between different data types by using different type conversion functions like int( ), float( ), str( ) etc. • Conversion from float to int • Conversion to and from string must contain compatible values. >>> float ( 5 ) 5.0 >>> int ( 10. 6 ) 10 >>> int (-10.6 ) -10 >>> float ( ‘ 2.5 ‘) 2.5 >>> str ( 25 ) ‘ 25 ‘
  • 18. • We can even convert one sequence into another • To convert each dictionary, each element must be a pair. >>> set ( [ 1, 2, 3 ] ) { 1, 2, 3 } >>> tuple ( { 5, 6, 7 } ) ( 5, 6, 7 ) >>> list ( ‘hello’ ) [ ‘h’, ‘e’, ‘l’, ‘l’, ‘o’ ] >>> dict ( [ [ 1, 2], [3, 4] ] ) { 1 : 2, 3 : 4 }