0% found this document useful (0 votes)
2 views9 pages

AI Class X Advance Python-Notes

The document provides an overview of Jupyter Notebook, a tool used in data science and education for creating interactive documents with live code and visualizations, and explains the importance of virtual environments in Python development. It details the installation and usage of Anaconda, which includes Jupyter Notebook, and outlines the key components and functionalities of both Anaconda and Jupyter Notebook. Additionally, it introduces Python, its features, applications, and notable platforms that utilize Python in their development.

Uploaded by

amaanmuslim5
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)
2 views9 pages

AI Class X Advance Python-Notes

The document provides an overview of Jupyter Notebook, a tool used in data science and education for creating interactive documents with live code and visualizations, and explains the importance of virtual environments in Python development. It details the installation and usage of Anaconda, which includes Jupyter Notebook, and outlines the key components and functionalities of both Anaconda and Jupyter Notebook. Additionally, it introduces Python, its features, applications, and notable platforms that utilize Python in their development.

Uploaded by

amaanmuslim5
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

Advanced Python Class 10 AI Notes

A Jupyter Notebook (introduced in 2014) is a powerful tool widely used in


the field of data science, research, and education. It provides an interactive
computing environment that allows you to create and share documents
containing live code, equations, visualisations, and narrative text.
Jupyter Notebooks support various programming languages, but it is most
commonly associated with Python. Working with Jupyter Notebook, virtual
environment is one of the most important tools that used by Python
developers.
Introduction to Virtual Environment
A virtual environment is a self-contained directory that encapsulates a
specific Python interpreter and its associated libraries. It allows you to create
an isolated environment for your Python projects, preventing conflicts
between dependencies and ensuring that each project has its own set of
libraries and packages.
By creating separate Python virtual environments for each project
1. To install Python virtual environment – JUPYTER Notebook using
ANACONDA, type the link: [Link]
2. Click on Download
3. Begin the installation process.
4. Getting through the License-Agreement.
5. Select Installation Type: Select Just Me if you want the software to be used
by a single user.
6. Choose Installation Location.
7. Click on ‘Install’ button.
8. Getting through the Installation Process.
9. Finishing the installation.
Steps for creating Virtual Environments
Step 1 : Open Anaconda prompt
Step 2 : As we open the Anaconda prompt, we can see that in the beginning of
the prompt message, the
term (base) is written.
Step 3 : Type “conda create -n myenvion python=3.8.10” in command prompt
Step 4 : After processing, the prompt will ask if we wish to proceed with
installations or not. Type Y
on it and press Enter.
Step 5 : Packages will start getting installed in the environment.
Step 6 : Once an environment has been successfully created.
Step 7 : Type “conda activate env” in command prompt
Once the installation is done, you can start using Anaconda.
Open Anaconda from the Start menu or by double click on the Anaconda icon
on your desktop (if you have the icon). Anaconda Navigator will open.
From the Anaconda Navigator – click on Launch button JUPYTER Notebook.
The Jupyter notebook will open in the default browser.
By creating separate Python virtual environments for each project, a virtual
environment is a tool that aids in maintaining the separation of dependencies
needed by various projects. The majority of Python developers utilise this as
one of their most important tools.
Anaconda
Anaconda is a free tool that helps you use Python for scientific computing. It
was created by Anaconda, Inc., a company founded by Peter Wang and
Travis Oliphant in 2012.
Key Components:
Anaconda Prompt: A command-line tool for writing Python programs in
different virtual environments.
Anaconda Navigator: A user-friendly desktop application that lets you
launch programs and manage Python packages without using command-line
commands. It works on Windows, MacOS, and Linux.
The Navigator includes the following applications by default:
 JupyterLab
❖ Spyder
❖ RStudio
❖ Jupyter Notebook
❖ Glue
❖ QtConsole
❖ Orange
Components of Jupyter Notebook

Menu Bar
Menu bar is at the top of the Notebook window. It has menus and icons that
let you choose commands, do tasks, and check the status. The menu bar
includes the following options:
* File menu: The file menu lets you do basic tasks like opening new
documents, opening existing notebooks, and saving or printing them.
* Edit menu: The edit menu allows you to do tasks like splitting cells, copying
cells, deleting cells, and other editing operations.
* View menu: The view menu helps you change the visibility of the header
and toolbar. You can also use it to show or hide line numbers.
* Insert menu: The insert menu lets you add cells anywhere you want to
include data. In Jupyter Notebook, this data can be Python code, output, or
raw text that gets converted into HTML.
* Cell menu: The cell menu has options to run all or specific cells in the
notebook. You can also use this menu to change the cell type to code or
markdown.
* Kernel menu: A kernel is a program that runs and inspects your code. In
Jupyter Notebook, the kernel menu lets you manage the kernel running in the
background. You can change the kernel at any time using this menu.
* Widgets menu: Widgets create interactive graphical interfaces for users.
The widgets menu lets you add widgets in different languages on the page.
* Help menu: The help menu offers useful information, including keyboard
shortcuts and links to documentation for modules like NumPy, SciPy, Pandas,
IPython, and Matplotlib.
* Toolbar: Contains icons for common actions like saving the notebook,
adding new cells, and running cells.
* Code cell: A space where you write and execute your Python code and see
the output directly below the cell.
B. Answer the following questions:
Q1: What is Jupyter Notebook, and why is it used?
Ans: A Jupyter Notebook (introduced in 2014) is a powerful tool widely
used in the field of data science, research, and education. It provides an
interactive computing environment that allows you to create and share
documents containing live code, equations, visualisations, and narrative text.
Jupyter Notebooks support various programming languages, but it is most
commonly associated with Python.
Q2: What is the use of the view menu in Jupyter Notebook?
Ans: The view menu helps you change the visibility of the header and
toolbar. You can also use it to show or hide line numbers that is it is used to
customize notebook layout and appearance.
Q3: What are the key components of Anaconda Navigator?
Ans: Key Components:
Anaconda Prompt: A command-line tool for writing Python programs in
different virtual environments.
Anaconda Navigator: A user-friendly desktop application that lets you
launch programs and manage Python packages without using command-line
commands. It works on Windows, MacOS, and Linux.
Q4: How do you run code in a Jupyter Notebook cell?
Ans: The notebook window displays a blank space or cell where you can write
Python code. When you create a new notebook, the first cell is available and
empty, ready for you to write your code.
Type the lines of code and execute them by pressing Shift + Enter or by
clicking the Run button. The output will appear below the cell, as shown.
Q5. What is the purpose of the kernel menu in Jupyter Notebook?
Ans: The Kernel menu in Jupyter Notebook acts as the control center for the
computational engine running your code, allowing you to interrupt, restart,
reconnect, or change the language environment (e.g., Python, R, Julia) for your
notebook.

Starting with practical:

Aim: To become familiar with the Jupyter Notebook interface and basic
functionalities.

Materials Needed:

Computer with internet access

Anaconda installed

Jupyter Notebook

Steps:

Step 1: Open Anaconda Navigator:

Search for ‘Anaconda Navigator’ in your computer’s search bar and open it.

Step 2: Launch Jupyter Notebook:

In the Anaconda Navigator, click on the ‘Launch’ button under Jupyter


Notebook. This will open Jupyter Notebook in your default web browser.

Step 3: Create a new Notebook:

In the Jupyter Notebook interface, go to the upper-right corner and click on


‘New’. Select ‘Notebook’ to create a new notebook.

Step 4: Explore the Notebook interface:

Menu bar: Explore different menus like File, Edit, View, Insert, Cell, Kernel,
Widgets, and Help.

Toolbar: Identify the different icons on the toolbar and their functions.
Code cell: Type a simple Python code in the first cell and run it by pressing
‘Shift + Enter’.

Markdown cell: Convert the next cell to Markdown by selecting ‘Markdown’


from the drop-down menu in the toolbar. Type a heading and some text.

Step 5: Save and name your notebook:

Go to the ‘File’ menu, select ‘Save and Checkpoint’ and then rename your
notebook by clicking on the notebook name ‘Untitled’ at the top and entering
a new name.

Step 6: Add more cells and practise:

Insert new cells using the ‘Insert’ menu or the ‘+’ button on the toolbar.

Practise running code and writing text in both code and markdown cells.

Conclusion:

You will be able to navigate the Jupyter Notebook interface, create and run
code cells, and use markdown cells for text and headings. You will also learn
to save and manage your notebooks.

Introduction to Python:
Guido Van Rossum, of Centrum Wiskunde & Informatica, is the inventor of
the Python programming. The language, which took its name from the 1970s
BBC comedy series “Monty Python’s Flying Circus,” was made available to the
general public in 1991. It can be used to programme in both an object-
oriented and procedural manner. Because it offers so many features, Python
is very popular.

Features of Python:
Artificial intelligence is the trending technology of the future. You can see so
many applications around you. If you as an individual can also develop an AI
application, you will require to know a programming language. There are
various programming languages like Lisp, Prolog, C++, Java and Python,
which can be used for developing applications of AI. Out of these, Python
gains a maximum popularity because of the following reasons:
 Easy to Learn and Read: Its syntax mirrors natural language, using
indentation instead of braces to define code blocks, which promotes
clean code.
 Interpreted Language: Code is executed line-by-line, which allows for
immediate testing and easier debugging.
 Cross-Platform Compatibility: Python programs can run on various
operating systems (Windows, macOS, Linux) with little to no
modification.
 Large Standard Library: It offers a massive collection of pre-built
modules, reducing the need to write code from scratch for common
tasks.
 Extensible and Embeddable: You can add low-level modules (like C or
C++) to the interpreter to customize tools or optimize performance
 Object-Oriented Programming Python: supports Object-Oriented
programming, allowing developers to create and use classes and objects,
promoting modularity and code reuse.
 Scalability: Python is scalable, making it applicable for small scripts as
well as large projects.
 Dynamically Typed: Variable types (like integers or strings) are
determined at runtime, meaning you don't need to declare them
explicitly.
Applications of Python:
 Web applications: We can use Python to develop web applications. It
provides libraries to handle internet protocols such as HTML and XML,
JSON, Email processing, request, Feedparser, etc.
 Desktop GUI Applications: The GUI stands for Graphical User Interface,
which provides a smooth interaction to any application. Python provides
a Tk GUI library to develop a user interface.
 Software Development: Python is useful for the software development
process. It works as a support language and can be used to build control
and management, testing, etc.
 Audio or Video-based Applications: Python is flexible to perform
multiple tasks and can be used to create multimedia applications. Some
multimedia applications which are made by using Python are TimPlayer,
Cplay, etc.
 Enterprise Applications: Python can be used to create applications
that can be used within an Enterprise or an Organization. Some real-
time applications are OpenERP, Tryton, etc.
 Image Processing Application: Python contains many libraries that are
used to work with the image. The image can be manipulated according
to our requirements.
Famous Application Built using Python
 YouTube: World’s largest video-sharing platform uses Python for features like
video streaming and backend services.
 Instagram: This popular social media app relies on Python’s simplicity for scaling
and handling millions of users.
 Spotify: Python is used for backend services and machine learning to personalize
music recommendations.
 Dropbox: The file hosting service uses Python for both its desktop client and
server-side operations.
 Netflix: Python powers key components of Netflix’s recommendation engine and
content delivery systems (CDN).
 Google: Python is one of the key languages used in Google for web crawling,
testing and data analysis.
 Uber: Python helps Uber handle dynamic pricing and route optimization using
machine learning.
 Pinterest: Python is used to process and store huge amounts of image data
efficiently.

You might also like