SlideShare a Scribd company logo
Jupyter Notebook
Python GUI
Class_X_PYTHON_J.pdf
• 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.
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
It works on…
• LOCALHOST 127.0.0.1
• Port Number 8888
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
• 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.
Class_X_PYTHON_J.pdf
• 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.
Class_X_PYTHON_J.pdf
• 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
Class_X_PYTHON_J.pdf
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
Class_X_PYTHON_J.pdf
• 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.
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
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
Ad

More Related Content

Similar to Class_X_PYTHON_J.pdf (20)

Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
Francis Densil Raj
 
Python Module-1.1.pdf
Python Module-1.1.pdfPython Module-1.1.pdf
Python Module-1.1.pdf
4HG19EC010HARSHITHAH
 
Python Programming.pdf
Python Programming.pdfPython Programming.pdf
Python Programming.pdf
ssuser9a6ca1
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
nagendrasai12
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
Akhil Kaushik
 
UNIT 1 .pptx
UNIT 1                                                .pptxUNIT 1                                                .pptx
UNIT 1 .pptx
Prachi Gawande
 
Python intro
Python introPython intro
Python intro
Piyush rai
 
PYTHON UNIT 1
PYTHON UNIT 1PYTHON UNIT 1
PYTHON UNIT 1
nagendrasai12
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptx
MohammedAlYemeni1
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
Arpittripathi45
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
HaythamBarakeh1
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
UpasnaSharma37
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
A Brief Introduction to Python - English
A Brief Introduction to Python - EnglishA Brief Introduction to Python - English
A Brief Introduction to Python - English
Devashish Negi
 
Python Programming
Python ProgrammingPython Programming
Python Programming
RenieMathews
 
Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
AliMohammadAmiri
 
1-ppt-python.ppt
1-ppt-python.ppt1-ppt-python.ppt
1-ppt-python.ppt
ssusera99a83
 
ITC 110 Week 10 Introdution to Python .pptx
ITC 110 Week 10  Introdution to Python .pptxITC 110 Week 10  Introdution to Python .pptx
ITC 110 Week 10 Introdution to Python .pptx
aaaaaannnnn6
 
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
MantoshKumar79
 
Python Programming.pdf
Python Programming.pdfPython Programming.pdf
Python Programming.pdf
ssuser9a6ca1
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Python programming ppt.pptx
Python programming ppt.pptxPython programming ppt.pptx
Python programming ppt.pptx
nagendrasai12
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
Akhil Kaushik
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptx
MohammedAlYemeni1
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
Arpittripathi45
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
HaythamBarakeh1
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
A Brief Introduction to Python - English
A Brief Introduction to Python - EnglishA Brief Introduction to Python - English
A Brief Introduction to Python - English
Devashish Negi
 
Python Programming
Python ProgrammingPython Programming
Python Programming
RenieMathews
 
ITC 110 Week 10 Introdution to Python .pptx
ITC 110 Week 10  Introdution to Python .pptxITC 110 Week 10  Introdution to Python .pptx
ITC 110 Week 10 Introdution to Python .pptx
aaaaaannnnn6
 
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
MantoshKumar79
 

Recently uploaded (20)

Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your CompetitorsAI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
Contify
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptxmd-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
fatimalazaar2004
 
Medical Dataset including visualizations
Medical Dataset including visualizationsMedical Dataset including visualizations
Medical Dataset including visualizations
vishrut8750588758
 
Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your CompetitorsAI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
Contify
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptxmd-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
fatimalazaar2004
 
Medical Dataset including visualizations
Medical Dataset including visualizationsMedical Dataset including visualizations
Medical Dataset including visualizations
vishrut8750588758
 
Ad

Class_X_PYTHON_J.pdf

  • 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.
  • 7. It works on… • LOCALHOST 127.0.0.1 • Port Number 8888
  • 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.
  • 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.
  • 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
  • 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
  • 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.
  • 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)))