SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 

Último (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 

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 }