0% found this document useful (0 votes)
11 views14 pages

Python Programming with Jupyter Notebook

The document provides an overview of Python programming and the use of Jupyter Notebook as an Integrated Development Environment (IDE). It covers the basics of Python, how to create and run code in Jupyter Notebook, types of programming errors, and emphasizes good programming style for readability and maintenance. The course uses Python 3.9 and includes practical examples and tips for effective coding.

Uploaded by

hanis haniff
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Python Programming with Jupyter Notebook

The document provides an overview of Python programming and the use of Jupyter Notebook as an Integrated Development Environment (IDE). It covers the basics of Python, how to create and run code in Jupyter Notebook, types of programming errors, and emphasizes good programming style for readability and maintenance. The course uses Python 3.9 and includes practical examples and tips for effective coding.

Uploaded by

hanis haniff
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming with

Jupyter Notebook

Prepared by Dr. Siti Radziah (Up: April 2021)


Python Programming Language

 Python is developed by Dutch Programmer, Guido Van Rossum (1980s)


 Python is one of the most powerful modern programming languages. It has
been used by giant companies and organization such as Google, Yahoo,
NASA etc.
 Compared with other programming languages (e.g C++), Python allows
using variables without declaring them, and it relies on indentation as
control structures.
 Python is a free software developing tools and offers a lot of free source
code over the internet.
 Expert programmer as well as beginners can use Python to solve interesting
problems faster than other languages.
 In this course, Python 3 will be used and the up to date version is Python 3.9
Jupyter Notebook IDE

 Integrated Development Environment (IDE) is a software that is used by


programmers to create, run and debug their developed program in one
application without the need to open additional programs.
 Jupyter Notebook will be used as the main IDE.
 Jupyter Notebook is an open-source IDE for Python programming that allow
users to create and share document that contain live code, equation,
visualization and narrative text. It is a web-based application and run using
internet browser such as Google Chrome and Microsoft Edge.
WORKING WITH JUPYTER NOTEBOOK IDE
(1) Create a New Notebook program
Click New, and
choose Python 3
from dropdown
menu

Can be edited for


file name

Notebook editor interface


(2) Running Code in Cell
 Cell is the location to write Python Code.
 It can be written into multiple snippets and put them into cells so they can
be executed individually.

Type In cell ln [1] and ln [2]


Then click button

Can click + to add cell


Can add cell above and below current cell
(3) Kernel Menu
 A kernel is defined as a program that executes and introspects the user’s
code.
 It comprises multiple selection include Interrupt, Restart, Restart & Clear
Output, Restart and Run All, Reconnect and Shutdown. Most of times, users
work with Kernel menu to debug or restarting the program.
(4) Exporting Notebook Python File
 The moment when user create new notebook program, a new IPython
Notebook file, with extension . Ipynb will be automatically created at the
location where user create new notebook.
 If the user want to export code from notebook to Python file;

Step 1

Step 2
EXAMPLE
Write and Run a program of additional two
numbers
TYPES OF PROGRAMMING ERRORS

 SYNTAX ERROR
 LOGIC ERROR
 RUNTIME ERROR
SYNTAX ERROR

 Common mistake -
grammatical mistake due
to misplacement of
punctuation, spelling error
etc.

 Program will not compile


and run untill been fix by
programmer
LOGIC ERROR
 Mistake in a source code of program that cause
incorrect input.

 Untraceable by the compiler and no error message

 Programmer shoud validate and cross checking


their output to prevent this type of error
RUNTIME ERROR
 Error that occurs when program is running
 Usually occurs due to insufficient amount of
computer memory
 Can be noticed when the program crash,
unexpected terminate while running
GOOD PROGRAMMING STYLE

 Good programming style with proper documentation make the program


easy to read, prevent error and ease to maintain in the future by other
programmer.
 The appropriate usage of comment that initiated by symbol # help to
separate the portion of the programming statement according to each
task.
 Proper spacing also make program look more neat and easy to read.
 For example sum=num1+num2 can be more clear if the code is written as
sum = num1 + num2

You might also like