SlideShare a Scribd company logo
1 of 37
RAMCO INSTITUTE OF TECHNOLOGY
TOPICS
Introduction to Anaconda & Navigator
General features
 Why We Should Learn Python
Python Application
Data types
Exercises on simple program execution
Active learning
12/21/2020
2
INTRODUCTION TO ANACONDA
Anaconda is an open-source distribution for
python. It is used for data science, machine
learning, deep learning, etc.
With the availability of more than 300 libraries
for data science, it becomes fairly optimal for
any programmer to work on anaconda for data
science.
Anaconda comes with a wide variety of tools to
easily collect data from various sources using
various machine learning and AI algorithms.
12/21/2020
3
ANACONDA NAVIGATOR
12/21/2020
4
Anaconda Navigator is a graphical user interface (GUI) included in allows
you to launch applications and easily manage packages, environments, and
channels without using command-line commands.
12/21/2020
5
12/21/2020
6
GENERAL FEATURES
12/21/2020
7
WHY WE SHOULD LEARN PYTHON
12/21/2020
8
12/21/2020
9
PYTHON APPLICATION
Web Development
Game Development
Machine Learning and Artificial
Intelligence
Data Science and Data Visualization
 Web Scraping Applications
12/21/2020
10
CONT…
Business Applications
CAD Applications
Embedded Applications
Well-known embedded application could
be the Raspberry Pi which uses Python
for its computing
12/21/2020
11
12/21/2020
12
Data type
• Data type refers to the type and size of data. Variables
can hold values of different data types. Python is a
purely object oriented language. It refers to everything
as an object, including numbers and strings.
• The six standard data types supported by python
includes:
12/21/2020
13
NUMBER
 Number refers to a numeric value. It includes integers,
floating point, and complex numbers
Example:
a = 5
print(a, type(a))
a = 2.0
print(a, type(a))
Output:
5 <class 'int'>
2.0 <class 'float'>
12/21/2020
14
EXAMPLE
12/21/2020
15
• List is an ordered sequence of items. All the items
in a list do not need to be of the same type.
• Lists are mutable. The elements in the list can be
modified.
• To declare a list in python, separate the items
using commas and enclose them within square
brackets [ ].
Example:
>>>a = [5,10,15,20,25,30,35,40]
>>>a[2]
15
DATA TYPE - LIST
12/21/2020
16
12/21/2020
17
LISTS ARE MUTABLE
>>>a = [5,10,15,20,25,30,35,40]
>>>a[3]=17
>>>a
>>>[5,10,15,17,25,30,35,40]
12/21/2020
18
EXAMPLE OF LIST
12/21/2020
19
TUPLE
• Tuple is an ordered sequence of items same as list.
The only difference is that tuples are immutable.
Tuples once created cannot be modified.
• It is defined within parentheses ( ) where items are
separated by commas
Example:
T=("apple","banana","cherry")
print(T)
T=("apple","banana","cherry")
print(T[1])
banana
12/21/2020
20
TUPLE ARE IMMUTABLE
>>> T=(1,"rit",5,7,10)
>>> T
(1, 'rit', 5, 7, 10)
>>> T[3]=4
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
T[3]=4
TypeError: 'tuple' object does not support item
assignment
>>>
12/21/2020
21
STRING
• A String in python can be a series or a
sequence of alphabets, numerals and
special characters.
• Single quotes or double quotes are used to
represent strings.
• >>> s = "This is a string"
• Strings are immutable.
12/21/2020
22
EXAMPLE OF STRING
>>> c="Ramco Institute of Technology"
>>> c
'Ramco Institute of Technology'
>>> print(c)
Ramco Institute of Technology
>>> c[4]
'o'
>>> c[7]
'n'
>>> c[4]="l"
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
c[4]="l"
TypeError: 'str' object does not support item assignment
12/21/2020
23
DICTIONARY
 A dictionary is a collection which is unordered, changeable and
indexed.
 In Python dictionaries are written with curly brackets, and they
have keys and values
Example:
>>> D={"Name":"Latha","Age":20}
>>> D
{'Name': 'Latha', 'Age': 20}
>>> D["Name"]
'Latha'
>>> D["Name"]="Sudha"
>>> D
{'Name': 'Sudha', 'Age': 20}
>>>
12/21/2020
24
12/21/2020
25
SET
12/21/2020
26
 Set is an unordered collection of data type that is
iterable, mutable and has no duplicate elements.
 Sets can be created by using the built-in set()
function with an iterable object or a sequence by
placing the sequence inside curly braces,
separated by ‘comma’. A set contains only
unique elements.
 The major advantage of using a set, as opposed
to a list, is that it has a highly optimized method
for checking whether a specific element is
contained in the set.
EXAMPLE SET
12/21/2020
27
12/21/2020
28
SIMPLE PROGRAM
#Addition of two number
a=19
b=23
c=a+b
print(c)
Output
42
#Getting the input from user
a=int(input("Enter the number"))
b=int(input("Enter another number"))
c=a+b
print(c)
Output
Enter the number5
Enter another number20
25
12/21/2020
29
#program to convert Celsius to Fahrenheit
celsius=int(input("Enter the celsius"))
fahrenheit =(celsius * 1.8) + 32
print(fahrenheit)
Output:
Enter the celsius45
113.0
12/21/2020
30
Calculator
a=int(input("Enter the number"))
b=int(input("Enter another the number"))
sum=a+b
differnce=a-b
product=a*b
quoitent=a/b
reminder=a%b
print("sum=",sum)
print(differnce)
print(quoitent)
print(reminder)
Output:
Enter the number10
Enter another the number5
sum= 15
5
2.0
0
12/21/2020
31
#Swapping of two number
a=5
b=7
temp=a
a=b
b=temp
print(a)
print(b)
Output:
7
5
12/21/2020
32
SIMPLE PROGRAM
#Program to find the area of circle
pi=3.14
r=float(input("Enter the Radius"))
area=pi*r*r
print(area)
Output:
Enter the Radius 5
78.5
>>>
12/21/2020
33
RECAP
12/21/2020
34
CLASS POLL
1.Which of these is not a core data type?
(A) Lists
(B) Dictionary
(C) Tuples
(D) Class
2.What is the output of the following code?
sampleSet = {"Jodi", "Eric", "Garry"}
sampleSet.add(1, "Vicki")
print(sampleSet)
A){‘Vicki’, ‘Jodi’, ‘Garry’, ‘Eric’}
B){‘Jodi’, ‘Vicki’, ‘Garry’, ‘Eric’}
C)The program executed with error
D) None of theses
12/21/2020
35
3.What is the output of the following code?
str = "pynative"
print (str[1:3])
A)py
B)yn
C)pyn
D)yna
12/21/2020
36
12/21/2020
37

More Related Content

Similar to Datatypes python programming

ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
alexstorer
 
Stat Design3 18 09
Stat Design3 18 09Stat Design3 18 09
Stat Design3 18 09
stat
 
Project Management System
Project Management SystemProject Management System
Project Management System
Divyen Patel
 
Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2
rowensCap
 

Similar to Datatypes python programming (20)

PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using Python
 
Tableau interview questions and answers
Tableau interview questions and answersTableau interview questions and answers
Tableau interview questions and answers
 
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfXII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
 
Python - Lecture 12
Python - Lecture 12Python - Lecture 12
Python - Lecture 12
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
R Get Started II
R Get Started IIR Get Started II
R Get Started II
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
 
Python-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxPython-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptx
 
4)12th_L-1_PYTHON-PANDAS-I.pptx
4)12th_L-1_PYTHON-PANDAS-I.pptx4)12th_L-1_PYTHON-PANDAS-I.pptx
4)12th_L-1_PYTHON-PANDAS-I.pptx
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
Stat Design3 18 09
Stat Design3 18 09Stat Design3 18 09
Stat Design3 18 09
 
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageJanuary 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
 
Project Management System
Project Management SystemProject Management System
Project Management System
 
R basics
R basicsR basics
R basics
 
ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And Representation
 
More on Pandas.pptx
More on Pandas.pptxMore on Pandas.pptx
More on Pandas.pptx
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
 
Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2
 

More from swarna sudha (6)

Positioning, pointing and drawing in Human computer Interaction
Positioning, pointing and drawing in Human computer Interaction Positioning, pointing and drawing in Human computer Interaction
Positioning, pointing and drawing in Human computer Interaction
 
Introduction to data link layer
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
 
Range, quartiles, and interquartile range
Range, quartiles, and interquartile rangeRange, quartiles, and interquartile range
Range, quartiles, and interquartile range
 
Foundations of hci the computer
Foundations of hci   the computerFoundations of hci   the computer
Foundations of hci the computer
 
Innovative teaching think pair share function
Innovative teaching think pair share  functionInnovative teaching think pair share  function
Innovative teaching think pair share function
 
Icmp
IcmpIcmp
Icmp
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Datatypes python programming

  • 1. RAMCO INSTITUTE OF TECHNOLOGY
  • 2. TOPICS Introduction to Anaconda & Navigator General features  Why We Should Learn Python Python Application Data types Exercises on simple program execution Active learning 12/21/2020 2
  • 3. INTRODUCTION TO ANACONDA Anaconda is an open-source distribution for python. It is used for data science, machine learning, deep learning, etc. With the availability of more than 300 libraries for data science, it becomes fairly optimal for any programmer to work on anaconda for data science. Anaconda comes with a wide variety of tools to easily collect data from various sources using various machine learning and AI algorithms. 12/21/2020 3
  • 4. ANACONDA NAVIGATOR 12/21/2020 4 Anaconda Navigator is a graphical user interface (GUI) included in allows you to launch applications and easily manage packages, environments, and channels without using command-line commands.
  • 8. WHY WE SHOULD LEARN PYTHON 12/21/2020 8
  • 10. PYTHON APPLICATION Web Development Game Development Machine Learning and Artificial Intelligence Data Science and Data Visualization  Web Scraping Applications 12/21/2020 10
  • 11. CONT… Business Applications CAD Applications Embedded Applications Well-known embedded application could be the Raspberry Pi which uses Python for its computing 12/21/2020 11
  • 13. Data type • Data type refers to the type and size of data. Variables can hold values of different data types. Python is a purely object oriented language. It refers to everything as an object, including numbers and strings. • The six standard data types supported by python includes: 12/21/2020 13
  • 14. NUMBER  Number refers to a numeric value. It includes integers, floating point, and complex numbers Example: a = 5 print(a, type(a)) a = 2.0 print(a, type(a)) Output: 5 <class 'int'> 2.0 <class 'float'> 12/21/2020 14
  • 16. • List is an ordered sequence of items. All the items in a list do not need to be of the same type. • Lists are mutable. The elements in the list can be modified. • To declare a list in python, separate the items using commas and enclose them within square brackets [ ]. Example: >>>a = [5,10,15,20,25,30,35,40] >>>a[2] 15 DATA TYPE - LIST 12/21/2020 16
  • 18. LISTS ARE MUTABLE >>>a = [5,10,15,20,25,30,35,40] >>>a[3]=17 >>>a >>>[5,10,15,17,25,30,35,40] 12/21/2020 18
  • 20. TUPLE • Tuple is an ordered sequence of items same as list. The only difference is that tuples are immutable. Tuples once created cannot be modified. • It is defined within parentheses ( ) where items are separated by commas Example: T=("apple","banana","cherry") print(T) T=("apple","banana","cherry") print(T[1]) banana 12/21/2020 20
  • 21. TUPLE ARE IMMUTABLE >>> T=(1,"rit",5,7,10) >>> T (1, 'rit', 5, 7, 10) >>> T[3]=4 Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> T[3]=4 TypeError: 'tuple' object does not support item assignment >>> 12/21/2020 21
  • 22. STRING • A String in python can be a series or a sequence of alphabets, numerals and special characters. • Single quotes or double quotes are used to represent strings. • >>> s = "This is a string" • Strings are immutable. 12/21/2020 22
  • 23. EXAMPLE OF STRING >>> c="Ramco Institute of Technology" >>> c 'Ramco Institute of Technology' >>> print(c) Ramco Institute of Technology >>> c[4] 'o' >>> c[7] 'n' >>> c[4]="l" Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> c[4]="l" TypeError: 'str' object does not support item assignment 12/21/2020 23
  • 24. DICTIONARY  A dictionary is a collection which is unordered, changeable and indexed.  In Python dictionaries are written with curly brackets, and they have keys and values Example: >>> D={"Name":"Latha","Age":20} >>> D {'Name': 'Latha', 'Age': 20} >>> D["Name"] 'Latha' >>> D["Name"]="Sudha" >>> D {'Name': 'Sudha', 'Age': 20} >>> 12/21/2020 24
  • 26. SET 12/21/2020 26  Set is an unordered collection of data type that is iterable, mutable and has no duplicate elements.  Sets can be created by using the built-in set() function with an iterable object or a sequence by placing the sequence inside curly braces, separated by ‘comma’. A set contains only unique elements.  The major advantage of using a set, as opposed to a list, is that it has a highly optimized method for checking whether a specific element is contained in the set.
  • 29. SIMPLE PROGRAM #Addition of two number a=19 b=23 c=a+b print(c) Output 42 #Getting the input from user a=int(input("Enter the number")) b=int(input("Enter another number")) c=a+b print(c) Output Enter the number5 Enter another number20 25 12/21/2020 29
  • 30. #program to convert Celsius to Fahrenheit celsius=int(input("Enter the celsius")) fahrenheit =(celsius * 1.8) + 32 print(fahrenheit) Output: Enter the celsius45 113.0 12/21/2020 30
  • 31. Calculator a=int(input("Enter the number")) b=int(input("Enter another the number")) sum=a+b differnce=a-b product=a*b quoitent=a/b reminder=a%b print("sum=",sum) print(differnce) print(quoitent) print(reminder) Output: Enter the number10 Enter another the number5 sum= 15 5 2.0 0 12/21/2020 31
  • 32. #Swapping of two number a=5 b=7 temp=a a=b b=temp print(a) print(b) Output: 7 5 12/21/2020 32
  • 33. SIMPLE PROGRAM #Program to find the area of circle pi=3.14 r=float(input("Enter the Radius")) area=pi*r*r print(area) Output: Enter the Radius 5 78.5 >>> 12/21/2020 33
  • 35. CLASS POLL 1.Which of these is not a core data type? (A) Lists (B) Dictionary (C) Tuples (D) Class 2.What is the output of the following code? sampleSet = {"Jodi", "Eric", "Garry"} sampleSet.add(1, "Vicki") print(sampleSet) A){‘Vicki’, ‘Jodi’, ‘Garry’, ‘Eric’} B){‘Jodi’, ‘Vicki’, ‘Garry’, ‘Eric’} C)The program executed with error D) None of theses 12/21/2020 35
  • 36. 3.What is the output of the following code? str = "pynative" print (str[1:3]) A)py B)yn C)pyn D)yna 12/21/2020 36