SlideShare a Scribd company logo
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

Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024Ortus Solutions, Corp
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfAMB-Review
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageGlobus
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion Clinic
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of ProgrammingMatt Welsh
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
 

Recently uploaded (20)

Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 

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 }