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.
10. PYTHON APPLICATION
Web Development
Game Development
Machine Learning and Artificial
Intelligence
Data Science and Data Visualization
Web Scraping Applications
12/21/2020
10
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
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