SlideShare a Scribd company logo
1 of 50
Download to read offline
Jupyter Notebook
Python GUI
• It is an incredibly powerful tool for
interactively developing and presenting AI
related projects.
• The Jupyter project is the successor to the
earlier IPython Notebook, which was first
published as a prototype in 2010.
• Different programming languages can be used
• Different programming languages can be used
within Jupyter Notebooks, Python remains the
most commonly used language for it.
• Jupyter Notebook is an open source web
application that can be used to create and
share documents that contain live code,
equations, visualizations, and text.
It works on…
• LOCALHOST 127.0.0.1
• Port Number 8888
• The easiest way to install and start using
Jupyter Notebook is through Anaconda.
• Anaconda is the most widely used Python
distribution for data science and comes pre-
loaded with all the most popular libraries and
tools.
• With Anaconda, comes the Anaconda
• With Anaconda, comes the Anaconda
Navigator through which we can scroll around
all the applications which come along with it.
• Jupyter notebook can easily be accessed using
the Anaconda Prompt with the help of a local
host.
• To work with Jupyter Notebook, it is necessary
to have a kernel on which it operates.
• A kernel provides programming language
support in Jupyter.
• IPython is the default kernel for Jupyter
Notebook.
• Therefore, whenever we need to work with
Jupyter Notebook in a virtual environment, we
first need to install a kernel inside the
environment in which the Jupyter notebook
will run.
Introduction to Virtual Environments
• A virtual environment is a tool that helps to
keep dependencies required by different
projects separated, by creating isolated
Python virtual environments for them.
Python virtual environments for them.
• This is one of the most important tools that
most of the Python developers use.
Why it is required?
• Imagine a scenario where we are working on two
Python-based projects and one of them works on
Python 2.7 and the other uses Python 3.7.
• In such situations virtual environment can be
really useful to maintain dependencies of both
the projects as the virtual environments will
make sure that these dependencies are not
the projects as the virtual environments will
make sure that these dependencies are not
conflicting with each other and no impact
reaches the base environment at any point in
time.
• Thus, different projects developed in the system
might have another environment to keep their
dependencies isolated from each other.
Introduction to Python
• Python is a programming language which was
created by Guido Van Rossum and publicly
released in 1991.
• It got its name from a BBC comedy series from
1970s – ‘Monty Python’s Flying Circus’.
• It can be used to follow both procedural
approach and object-oriented approach of
programming.
• Python has a lot of functionalities which
makes it so popular to use.
• Artificial intelligence is the trending
technology of the future.
• We can see so many applications around us.
• If we as individuals would also like to develop
an AI application, we will need to know a
programming language.
programming language.
• There are various programming languages like
Lisp, Prolog, C++, Java and Python, which can
be used for developing applications of AI.
Python gains a maximum popularity
because of the following reasons:
• Easy to learn, read and maintain
• Python has few keywords, simple structure
and a clearly defined syntax.
• Python allows anyone to learn the language
• Python allows anyone to learn the language
quickly.
• A program written in Python is fairly easy-to-
maintain.
• A Broad Standard library
• Python has a huge bunch of libraries with
plenty of built-in functions to solve a variety of
problems.
problems.
• Interactive Mode
• Python has support for an interactive mode
which allows interactive testing and
debugging of snippets of code.
debugging of snippets of code.
• Portability and Compatibility
• Python can run on a wide variety of operating
systems and hardware platforms, and has the
same interface on all platforms.
same interface on all platforms.
• Extendable
• We can add low-level modules to the Python
interpreter.
• These modules enable programmers to add to
• These modules enable programmers to add to
or customize their tools to be more efficient.
Applications of Python
• Software Development
• Games and 3D Graphics
• Database Access
• Business Applications
• Business Applications
• Web and Internet Development
• Desktop GUI Applications
Python Basics
• Printing Statements
• We can use Python to display outputs for any
code we write.
code we write.
• To print any statement, we use print()
function in Python.
• Python Statements and Comments
• Instructions written in the source code to
execute are known as statements.
• These are the lines of code which we write for
the computer to work upon.
• For example, if we wish to print the addition
of two numbers, say 5 and 10, we would
of two numbers, say 5 and 10, we would
simply write: print(5+10)
• This is a Python statement as the computer
would go through it and do the needful (which
in this case would be to calculate 5+10 and
print it on the output screen)
• On the other hand, there exist some statements
which do not get executed by the computer.
• These lines of code are skipped by the machine.
• They are known as comments.
• Comments are the statements which are
incorporated in the code to give a better
understanding of code statements to the user.
• To write a comment in Python, one can use # and
• To write a comment in Python, one can use # and
then write anything after it.
• For example:
• # This is a comment and will not be read by the
machine.
• print(5+10) # This is a statement and the
machine will print the summation.
• Keywords & Identifiers
• In Python, there exist some words which are
pre-defined and carry a specific meaning for
the machine by default.
• These words are known as keywords.
Keywords cannot be changed at any point in
time and should not be used any other way
time and should not be used any other way
except the default one, otherwise they create
confusion and might result in ambiguous
outputs.
• An identifier is any word which is variable.
Identifiers can be declared by the user as per
their convenience of use and can vary
according to the way the user wants.
• These words are not defined and can be used
in any way.
• Keywords cannot be used as identifiers.
• Identifiers are also case-sensitive hence an
identifier named as Test would be different
from an identifier named test.
• Variables
• A variable is a named location used to store
data in the memory.
• It is helpful to think of variables as a container
that holds data which can be changed later
throughout programming.
throughout programming.
• Just like in Mathematics, in Python too we can
use variables to store values in it.
• The difference here is, that in Python, the
variables not only store numerical values, but
can also contain different types of data.
• For example:
• X = 10
# X variable contains numerical data
• Letters = ‘XYZ’
# Letters variable contains alphabetic data
• number = 13.95
• number = 13.95
# number variable contains a decimal value
• word = ‘k’
# word variable contains a character
The rules for naming an identifier in
Python are as follows:
• The name should begin with
– an uppercase or a lowercase alphabet or
– an underscore sign (_).
This may be followed by any combination of
characters a-z, A-Z, 0-9 or underscore (_).
Thus, an identifier cannot start with a digit.
Thus, an identifier cannot start with a digit.
• It can be of any length.
(However, it is preferred to keep it short and meaningful).
• It should not be a keyword or reserved word .
• We cannot use special symbols like !, @, #, $, %,
etc. in identifiers .
TOKENS IN PYTHON
• Smallest individual unit in a program is
known as token.
• Keywords
• Identifiers
• Identifiers
• Literals
• Operators
• Punctuators
Data Types
Data types Specifies which type of value a variable
can store.
Data Types
Numbers (int, Float)
Boolean
Boolean
Tuple
List
String
Set
Dictionary
• Python inputs
• To collect the data from the user at the time
of execution, input() function is used.
• While using the input function, the datatype
of the expected input is required to be
mentioned so that the machine does not
mentioned so that the machine does not
interpret the received data in an incorrect
manner
• As the data taken as input from the user is
considered to be a string (sequence of
characters) by default.
• Python Operators
• Operators are special symbols which represent
computation.
• They are applied on operand(s), which can be
values or variables.
• Same operators can behave differently on
different data types.
different data types.
• Operators when applied on operands form an
expression.
• Operators are categorized as Arithmetic,
Relational, Logical and Assignment.
• Value and variables when used with operators are
known as operands.
Expressions
• An expression is defined as a combination of
constants, variables and operators.
• An expression always evaluates to a value.
• A value or a standalone variable is also
considered as an expression but a standalone
considered as an expression but a standalone
operator is not an expression.
• Some examples of valid expressions are given
below.
• (i) num – 20.4 (iii) 23/3 -5 * 7*(14 -2)
• (ii) 3.0 + 3.14 (iv) "Global"+"Citizen"
Give the output of the following when
num1 = 5, num2 = 4, num3 = 1
a) num1 += num2 + num3
b) num1 = num1 ** (num2 + num3)
c) num1 **= num2 + c
d) num1 = '5' + '5'
d) num1 = '5' + '5'
e) print(4.00/(2.0+2.0))
f) num1 = 2+9*((3*12)-8)/10
g) num1 = float(10)
h) num1 = int('3.14')
• print('Bye' == 'BYE')
• print(10 != 9 and 20 >= 20)
• print(10 + 6 * 2 ** 2 != 9//4 -3 and 29>= 29/9)
• print(5 % 10 + 10 < 50 and 29 <= 29)
• print((0 < 6) or (not(10 == 6) and (10<0)))
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf

More Related Content

Similar to Class_X_PYTHON_J.pdf

Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
nagendrasai12
 
PYTHON UNIT 1
PYTHON UNIT 1PYTHON UNIT 1
PYTHON UNIT 1
nagendrasai12
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
HassanShah396906
 
Chapter-introduction about java programming
Chapter-introduction about java programmingChapter-introduction about java programming
Chapter-introduction about java programming
DrRajeshkumarPPatel
 

Similar to Class_X_PYTHON_J.pdf (20)

Python Programming.pdf
Python Programming.pdfPython Programming.pdf
Python Programming.pdf
 
Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Python intro
Python introPython intro
Python intro
 
PYTHON UNIT 1
PYTHON UNIT 1PYTHON UNIT 1
PYTHON UNIT 1
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptx
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
 
1-ppt-python.ppt
1-ppt-python.ppt1-ppt-python.ppt
1-ppt-python.ppt
 
Python for students step by step guidance
Python for students step by step guidancePython for students step by step guidance
Python for students step by step guidance
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
Chapter-introduction about java programming
Chapter-introduction about java programmingChapter-introduction about java programming
Chapter-introduction about java programming
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 

Recently uploaded

➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
amitlee9823
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
only4webmaster01
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
amitlee9823
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
karishmasinghjnh
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
CHEAP Call Girls in Rabindra Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Rabindra Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Rabindra Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Rabindra Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 

Recently uploaded (20)

➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
CHEAP Call Girls in Rabindra Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Rabindra Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Rabindra Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Rabindra Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Detecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning ApproachDetecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning Approach
 

Class_X_PYTHON_J.pdf

  • 2.
  • 3. • It is an incredibly powerful tool for interactively developing and presenting AI related projects. • The Jupyter project is the successor to the earlier IPython Notebook, which was first published as a prototype in 2010. • Different programming languages can be used • Different programming languages can be used within Jupyter Notebooks, Python remains the most commonly used language for it. • Jupyter Notebook is an open source web application that can be used to create and share documents that contain live code, equations, visualizations, and text.
  • 4.
  • 5.
  • 6.
  • 7. It works on… • LOCALHOST 127.0.0.1 • Port Number 8888
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. • The easiest way to install and start using Jupyter Notebook is through Anaconda. • Anaconda is the most widely used Python distribution for data science and comes pre- loaded with all the most popular libraries and tools. • With Anaconda, comes the Anaconda • With Anaconda, comes the Anaconda Navigator through which we can scroll around all the applications which come along with it. • Jupyter notebook can easily be accessed using the Anaconda Prompt with the help of a local host.
  • 14.
  • 15. • To work with Jupyter Notebook, it is necessary to have a kernel on which it operates. • A kernel provides programming language support in Jupyter. • IPython is the default kernel for Jupyter Notebook. • Therefore, whenever we need to work with Jupyter Notebook in a virtual environment, we first need to install a kernel inside the environment in which the Jupyter notebook will run.
  • 16. Introduction to Virtual Environments • A virtual environment is a tool that helps to keep dependencies required by different projects separated, by creating isolated Python virtual environments for them. Python virtual environments for them. • This is one of the most important tools that most of the Python developers use.
  • 17. Why it is required? • Imagine a scenario where we are working on two Python-based projects and one of them works on Python 2.7 and the other uses Python 3.7. • In such situations virtual environment can be really useful to maintain dependencies of both the projects as the virtual environments will make sure that these dependencies are not the projects as the virtual environments will make sure that these dependencies are not conflicting with each other and no impact reaches the base environment at any point in time. • Thus, different projects developed in the system might have another environment to keep their dependencies isolated from each other.
  • 18. Introduction to Python • Python is a programming language which was created by Guido Van Rossum and publicly released in 1991. • It got its name from a BBC comedy series from 1970s – ‘Monty Python’s Flying Circus’. • It can be used to follow both procedural approach and object-oriented approach of programming. • Python has a lot of functionalities which makes it so popular to use.
  • 19. • Artificial intelligence is the trending technology of the future. • We can see so many applications around us. • If we as individuals would also like to develop an AI application, we will need to know a programming language. programming language. • There are various programming languages like Lisp, Prolog, C++, Java and Python, which can be used for developing applications of AI.
  • 20. Python gains a maximum popularity because of the following reasons: • Easy to learn, read and maintain • Python has few keywords, simple structure and a clearly defined syntax. • Python allows anyone to learn the language • Python allows anyone to learn the language quickly. • A program written in Python is fairly easy-to- maintain.
  • 21. • A Broad Standard library • Python has a huge bunch of libraries with plenty of built-in functions to solve a variety of problems. problems.
  • 22. • Interactive Mode • Python has support for an interactive mode which allows interactive testing and debugging of snippets of code. debugging of snippets of code.
  • 23. • Portability and Compatibility • Python can run on a wide variety of operating systems and hardware platforms, and has the same interface on all platforms. same interface on all platforms.
  • 24. • Extendable • We can add low-level modules to the Python interpreter. • These modules enable programmers to add to • These modules enable programmers to add to or customize their tools to be more efficient.
  • 25. Applications of Python • Software Development • Games and 3D Graphics • Database Access • Business Applications • Business Applications • Web and Internet Development • Desktop GUI Applications
  • 26. Python Basics • Printing Statements • We can use Python to display outputs for any code we write. code we write. • To print any statement, we use print() function in Python.
  • 27. • Python Statements and Comments • Instructions written in the source code to execute are known as statements. • These are the lines of code which we write for the computer to work upon. • For example, if we wish to print the addition of two numbers, say 5 and 10, we would of two numbers, say 5 and 10, we would simply write: print(5+10) • This is a Python statement as the computer would go through it and do the needful (which in this case would be to calculate 5+10 and print it on the output screen)
  • 28. • On the other hand, there exist some statements which do not get executed by the computer. • These lines of code are skipped by the machine. • They are known as comments. • Comments are the statements which are incorporated in the code to give a better understanding of code statements to the user. • To write a comment in Python, one can use # and • To write a comment in Python, one can use # and then write anything after it. • For example: • # This is a comment and will not be read by the machine. • print(5+10) # This is a statement and the machine will print the summation.
  • 29. • Keywords & Identifiers • In Python, there exist some words which are pre-defined and carry a specific meaning for the machine by default. • These words are known as keywords. Keywords cannot be changed at any point in time and should not be used any other way time and should not be used any other way except the default one, otherwise they create confusion and might result in ambiguous outputs.
  • 30.
  • 31. • An identifier is any word which is variable. Identifiers can be declared by the user as per their convenience of use and can vary according to the way the user wants. • These words are not defined and can be used in any way. • Keywords cannot be used as identifiers. • Identifiers are also case-sensitive hence an identifier named as Test would be different from an identifier named test.
  • 32. • Variables • A variable is a named location used to store data in the memory. • It is helpful to think of variables as a container that holds data which can be changed later throughout programming. throughout programming. • Just like in Mathematics, in Python too we can use variables to store values in it. • The difference here is, that in Python, the variables not only store numerical values, but can also contain different types of data.
  • 33. • For example: • X = 10 # X variable contains numerical data • Letters = ‘XYZ’ # Letters variable contains alphabetic data • number = 13.95 • number = 13.95 # number variable contains a decimal value • word = ‘k’ # word variable contains a character
  • 34. The rules for naming an identifier in Python are as follows: • The name should begin with – an uppercase or a lowercase alphabet or – an underscore sign (_). This may be followed by any combination of characters a-z, A-Z, 0-9 or underscore (_). Thus, an identifier cannot start with a digit. Thus, an identifier cannot start with a digit. • It can be of any length. (However, it is preferred to keep it short and meaningful). • It should not be a keyword or reserved word . • We cannot use special symbols like !, @, #, $, %, etc. in identifiers .
  • 35. TOKENS IN PYTHON • Smallest individual unit in a program is known as token. • Keywords • Identifiers • Identifiers • Literals • Operators • Punctuators
  • 36.
  • 37. Data Types Data types Specifies which type of value a variable can store. Data Types Numbers (int, Float) Boolean Boolean Tuple List String Set Dictionary
  • 38.
  • 39. • Python inputs • To collect the data from the user at the time of execution, input() function is used. • While using the input function, the datatype of the expected input is required to be mentioned so that the machine does not mentioned so that the machine does not interpret the received data in an incorrect manner • As the data taken as input from the user is considered to be a string (sequence of characters) by default.
  • 40. • Python Operators • Operators are special symbols which represent computation. • They are applied on operand(s), which can be values or variables. • Same operators can behave differently on different data types. different data types. • Operators when applied on operands form an expression. • Operators are categorized as Arithmetic, Relational, Logical and Assignment. • Value and variables when used with operators are known as operands.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45. Expressions • An expression is defined as a combination of constants, variables and operators. • An expression always evaluates to a value. • A value or a standalone variable is also considered as an expression but a standalone considered as an expression but a standalone operator is not an expression. • Some examples of valid expressions are given below. • (i) num – 20.4 (iii) 23/3 -5 * 7*(14 -2) • (ii) 3.0 + 3.14 (iv) "Global"+"Citizen"
  • 46. Give the output of the following when num1 = 5, num2 = 4, num3 = 1 a) num1 += num2 + num3 b) num1 = num1 ** (num2 + num3) c) num1 **= num2 + c d) num1 = '5' + '5' d) num1 = '5' + '5' e) print(4.00/(2.0+2.0)) f) num1 = 2+9*((3*12)-8)/10 g) num1 = float(10) h) num1 = int('3.14')
  • 47. • print('Bye' == 'BYE') • print(10 != 9 and 20 >= 20) • print(10 + 6 * 2 ** 2 != 9//4 -3 and 29>= 29/9) • print(5 % 10 + 10 < 50 and 29 <= 29) • print((0 < 6) or (not(10 == 6) and (10<0)))