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

Notes Important

The document provides a comprehensive overview of Artificial Intelligence (AI), covering its definition, main domains, applications, and ethical considerations. It details the AI project cycle, advanced Python programming, data science, computer vision, and natural language processing (NLP), along with practical coding examples. Additionally, it discusses model evaluation metrics and real-life applications of AI in various fields.

Uploaded by

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

Notes Important

The document provides a comprehensive overview of Artificial Intelligence (AI), covering its definition, main domains, applications, and ethical considerations. It details the AI project cycle, advanced Python programming, data science, computer vision, and natural language processing (NLP), along with practical coding examples. Additionally, it discusses model evaluation metrics and real-life applications of AI in various fields.

Uploaded by

staffgroup2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Chapter 1: Introduction to Artificial Intelligence (AI)

1. What is Artificial Intelligence (AI)?


AI refers to the simulation of human intelligence in machines that are programmed to
think, learn, and solve problems like humans.

2. Name the three main domains of AI.

 Data Science
 Computer Vision
 Natural Language Processing (NLP)

3. List some real-life applications of AI.

 Virtual assistants like Siri and Alexa


 Self-driving cars
 Personalized recommendations on platforms like Netflix

4. What are AI ethics?


AI ethics deal with the moral principles guiding the development and use of AI, such
as fairness, transparency, and privacy.

5. How does AI help achieve Sustainable Development Goals (SDGs)?


AI aids in addressing global challenges, such as improving healthcare, optimizing
agriculture, and combating climate change.

Chapter 2: AI Project Cycle

6. What are the stages of the AI Project Cycle?

 Problem Scoping
 Data Acquisition
 Data Exploration
 Modeling
 Evaluation

7. What is the importance of problem scoping in an AI project?


Problem scoping defines the project goals, objectives, and constraints, ensuring a
clear direction for the AI model.

8. Explain the term “Data Acquisition.”


Data acquisition is the process of collecting relevant and reliable data for training and
testing an AI model.
9. What is data visualization? Why is it important?
Data visualization involves graphical representation of data. It helps in identifying
patterns, trends, and insights for decision-making.

10. What does “Evaluation” mean in the AI Project Cycle?


Evaluation assesses the performance of an AI model using metrics like accuracy,
precision, recall, and F1 score.

Chapter 3: Advanced Python

11. Define a variable in Python.


A variable is a container for storing data values in a program.

12. What is the difference between a list and a tuple in Python?

 List: Mutable (can be changed), e.g., [1, 2, 3]


 Tuple: Immutable (cannot be changed), e.g., (1, 2, 3)

13. Write a Python program to calculate the sum of two numbers.

a=5
b = 10
print("Sum:", a + b)

14. Name three Python libraries commonly used in AI.

 NumPy
 Pandas
 Matplotlib

15. What is the purpose of Jupyter Notebook?


Jupyter Notebook is an open-source tool for writing, testing, and sharing Python code
in an interactive format.

Chapter 4: Data Science

16. Define data science.


Data science is the study of data to extract meaningful insights using techniques like
analysis, visualization, and modeling.
17. What is NumPy used for in Python?
NumPy is used for numerical computations, such as array operations and
mathematical functions.

18. Write a Python program to calculate the mean of a dataset.

import numpy as np
data = [10, 20, 30, 40]
mean = np.mean(data)
print("Mean:", mean)

19. Explain the term “data exploration.”


Data exploration involves examining data sets to summarize their characteristics,
often using statistical tools.

20. What are the common types of graphs used in data visualization?

 Line chart
 Bar graph
 Scatter plot

Chapter 5: Computer Vision

21. What is Computer Vision (CV)?


CV is a field of AI that enables machines to interpret and analyze visual information
from images or videos.

22. Explain the term “pixel.”


A pixel is the smallest unit of a digital image, representing a single point of color.

23. What is the purpose of OpenCV in AI?


OpenCV is an open-source library used for image processing and computer vision
tasks.

24. Write a Python program to read and display an image using OpenCV.

import cv2
image = cv2.imread('image.jpg')
cv2.imshow('Image', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

25. What are RGB images?


RGB images use three color channels—Red, Green, and Blue—to represent colors
in a digital image.
Chapter 6: Natural Language Processing (NLP)

26. Define Natural Language Processing.


NLP is a field of AI that enables machines to understand, interpret, and generate
human language.

27. What is tokenization in NLP?


Tokenization is the process of breaking a text into smaller units like words or
sentences.

28. Write a Python program to tokenize a sentence using NLTK.

from nltk.tokenize import word_tokenize


sentence = "AI is transforming the world."
tokens = word_tokenize(sentence)
print(tokens)

29. Explain the Bag-of-Words model in NLP.


The Bag-of-Words model represents text data as a collection of words and their
frequency, ignoring grammar and word order.

30. List some applications of NLP in daily life.

 Chatbots
 Sentiment analysis
 Translation tools

Chapter 7: Evaluation

31. What is model evaluation?


Model evaluation measures the performance of an AI model using specific metrics.

32. Define accuracy, precision, recall, and F1 score.

 Accuracy: Percentage of correct predictions.


 Precision: Ratio of true positives to all predicted positives.
 Recall: Ratio of true positives to all actual positives.
 F1 Score: Harmonic mean of precision and recall.

33. Write an example of a confusion matrix.


Predicted Positive Negative

Positive True Positive False Negative

Negative False Positive True Negative

34. Why is a confusion matrix important?


It provides a detailed breakdown of model predictions, helping to identify errors and
areas for improvement.

35. What is underfitting and overfitting?

 Underfitting: Model is too simple and performs poorly.


 Overfitting: Model is too complex and performs well on training data but
poorly on new data.

More Practice Questions by Topic

Problem-Solving in AI

36.What is supervised learning?


37.Explain reinforcement learning with an example.

Programming with Python

38.Write a program to calculate the median using NumPy.


39.How do you create a scatter plot in Matplotlib?

Real-Life Applications

40.How does AI contribute to healthcare?


41.What role does AI play in climate change solutions?

Chapter 7: Evaluation (Continued)

36. Why is the F1 score important in evaluating AI models?


The F1 score balances precision and recall, making it useful when dealing with
imbalanced datasets.

37. What is the difference between validation and testing in model evaluation?
 Validation: Used during model training to tune parameters.
 Testing: Used after training to measure the model’s final performance.

38. Write a formula to calculate precision.


Precision=True PositivesTrue Positives + False Positives\text{Precision} = \frac{\
text{True Positives}}{\text{True Positives + False Positives}}

39. What is the role of a confusion matrix?


A confusion matrix evaluates a model by showing the number of true/false positives
and true/false negatives.

40. How do you determine if a model is overfitting?


If a model performs well on training data but poorly on validation or test data, it is
overfitting.

Advanced Python Programming (Additional Questions)

41. How do you create a virtual environment in Python?


Run the following command:

python -m venv env_name

42. What is the purpose of the matplotlib library?


Matplotlib is used for creating static, interactive, and animated visualizations in
Python.

43. Write a Python program to create a line graph using Matplotlib.

import matplotlib.pyplot as plt


x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
plt.plot(x, y)
plt.title("Line Graph Example")
plt.show()

44. How do you import the Pandas library in Python?


Use the command:

import pandas as pd

45. What is the difference between df.head() and df.tail() in Pandas?

 df.head(): Displays the first 5 rows of a DataFrame.


 df.tail(): Displays the last 5 rows of a DataFrame.
Data Science (Additional Questions)

46. What is the difference between structured and unstructured data?

 Structured Data: Organized in a fixed format, like rows and columns (e.g.,
databases).
 Unstructured Data: Does not follow a specific format (e.g., images, videos).

47. Write a Python program to calculate the standard deviation of a dataset.

import numpy as np
data = [10, 20, 30, 40]
std_dev = np.std(data)
print("Standard Deviation:", std_dev)

48. What is a CSV file, and why is it important in data science?


A CSV (Comma-Separated Values) file is a simple file format used to store tabular
data, making it easy to import and manipulate in Python.

49. What are the key steps in data preprocessing?

 Cleaning
 Normalization
 Transformation
 Feature selection

50. Define outlier detection in data analysis.


Outlier detection involves identifying data points that differ significantly from the
majority of the dataset.

Computer Vision (Additional Questions)

51. What are the basic tasks in computer vision?

 Image classification
 Object detection
 Image segmentation

52. Write a Python program to convert a color image to grayscale using


OpenCV.

import cv2
image = cv2.imread('image.jpg')
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('Grayscale Image', gray_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

53. What is the difference between grayscale and RGB images?

 Grayscale: Contains shades of gray, using one channel.


 RGB: Contains colors represented by three channels (Red, Green, Blue).

54. Define feature extraction in computer vision.


Feature extraction identifies important parts of an image (e.g., edges, corners) for
analysis.

55. Explain the role of convolutional neural networks (CNNs) in computer


vision.
CNNs are deep learning models that process visual data, excelling in tasks like
image recognition and object detection.

Natural Language Processing (NLP) (Additional Questions)

56. What is sentiment analysis in NLP?


Sentiment analysis determines the sentiment (positive, negative, or neutral)
expressed in a text.

57. Write a Python program to remove stopwords using NLTK.

from nltk.corpus import stopwords


from nltk.tokenize import word_tokenize
text = "AI is changing the world rapidly."
stop_words = set(stopwords.words('english'))
words = word_tokenize(text)
filtered_words = [w for w in words if w.lower() not in stop_words]
print(filtered_words)

58. What are stopwords?


Stopwords are common words (e.g., “and,” “the”) that are often removed from text
data as they add little meaning.

59. What is text normalization?


Text normalization converts text to a standard form, involving steps like lowercasing,
removing punctuation, and stemming.
60. Explain the term “TF-IDF.”
TF-IDF (Term Frequency-Inverse Document Frequency) measures the importance of
a term in a document relative to a collection of documents.

Real-Life Applications of AI

61. How does AI help in healthcare?


AI enables early diagnosis, personalized treatment, and predictive analytics in
healthcare.

62. What is the role of AI in agriculture?


AI helps optimize crop yields, detect diseases, and automate farming tasks using
drones and sensors.

63. Name three AI-powered virtual assistants.

 Siri
 Alexa
 Google Assistant

64. How does AI improve customer service?


AI chatbots and sentiment analysis help provide faster, more personalized customer
support.

65. Explain the role of AI in e-commerce.


AI powers personalized product recommendations, inventory management, and fraud
detection.

Model Evaluation (Additional Questions)

66. What is a True Positive (TP)?


A TP occurs when the model correctly predicts a positive outcome.

67. What is a False Negative (FN)?


An FN occurs when the model incorrectly predicts a negative outcome for a positive
case.

68. Write a Python function to calculate accuracy from a confusion matrix.

def calculate_accuracy(tp, tn, fp, fn):


total = tp + tn + fp + fn
return (tp + tn) / total
69. Why is precision important in fraud detection?
Precision ensures that flagged cases are truly fraudulent, minimizing false alarms.

70. What is the difference between Recall and Sensitivity?


Recall and sensitivity both measure the ability to identify actual positives, but
sensitivity is commonly used in medical diagnostics.

Chapter 7: Evaluation (Continued)

71. What is recall, and why is it important?


Recall measures how well a model identifies all relevant instances. It is critical in
cases like medical diagnosis, where missing a positive case can have severe
consequences.

72. Write the formula to calculate recall.


Recall=True PositivesTrue Positives+False Negatives\text{Recall} = \frac{\text{True
Positives}}{\text{True Positives} + \text{False Negatives}}

73. What is the F1 score, and when should it be used?


The F1 score is the harmonic mean of precision and recall. It is used when there is
an imbalance between false positives and false negatives.

74. What is a confusion matrix, and how is it constructed?


A confusion matrix is a table that summarizes the performance of a classification
model by showing true positives, true negatives, false positives, and false negatives.

75. How is overfitting prevented in AI models?


Overfitting can be prevented by:

 Using simpler models.


 Employing techniques like regularization.
 Using cross-validation during model training.

Advanced Python Programming (Additional Questions)

76. Write a Python program to find the largest number in a list.

numbers = [10, 20, 30, 40, 50]


largest = max(numbers)
print("Largest number:", largest)
77. How do you install a Python library?
Run the following command in your terminal:

pip install library_name

78. What is the difference between a for loop and a while loop in Python?

 For loop: Iterates over a sequence (e.g., list or range).


 While loop: Repeats as long as a condition is true.

79. Write a Python program to generate a bar chart using Matplotlib.

import matplotlib.pyplot as plt


categories = ['A', 'B', 'C']
values = [30, 40, 50]
plt.bar(categories, values)
plt.title("Bar Chart Example")
plt.show()

80. What is the purpose of the pandas library?


Pandas is used for data manipulation and analysis, providing tools to work with
structured data like DataFrames.

Data Science (Additional Questions)

81. What are the common types of data in AI?

 Structured Data: Tabular format.


 Unstructured Data: Images, videos, text.
 Semi-Structured Data: JSON, XML files.

82. What is the importance of cleaning data in data science?


Data cleaning ensures the dataset is free of errors, missing values, and
inconsistencies, improving model accuracy.

83. Write a Python program to read a CSV file using Pandas.

import pandas as pd
data = pd.read_csv('data.csv')
print(data.head())

84. Define feature engineering.


Feature engineering involves creating new features or modifying existing ones to
improve a model’s performance.
85. What are the common statistical measures used in data science?

 Mean
 Median
 Mode
 Standard Deviation

Computer Vision (Additional Questions)

86. What is the role of kernels in image processing?


Kernels are small matrices used to apply transformations like edge detection or
blurring in images.

87. Write a Python program to apply Gaussian blur to an image using OpenCV.

import cv2
image = cv2.imread('image.jpg')
blurred_image = cv2.GaussianBlur(image, (5, 5), 0)
cv2.imshow('Blurred Image', blurred_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

88. What is the difference between edge detection and segmentation in CV?

 Edge Detection: Identifies boundaries in an image.


 Segmentation: Divides an image into meaningful regions.

89. Explain the term “object detection.”


Object detection involves identifying and locating objects within an image or video.

90. What is the significance of OpenCV in AI?


OpenCV is a widely used library for image processing and computer vision, enabling
tasks like object detection, face recognition, and image manipulation.

Natural Language Processing (NLP) (Additional Questions)

91. What are the major challenges in NLP?

 Ambiguity in language.
 Understanding context.
 Handling unstructured data.
92. Write a Python program to count the frequency of words in a text.

from collections import Counter


text = "AI is transforming the world. AI is everywhere."
word_count = Counter(text.split())
print(word_count)

93. What is lemmatization in NLP?


Lemmatization reduces words to their root forms, considering the context (e.g.,
“running” → “run”).

94. Explain the term “language model.”


A language model predicts the likelihood of a sequence of words, helping in tasks
like text generation and translation.

95. What is the purpose of text vectorization in NLP?


Text vectorization converts text into numerical data for machine learning algorithms
to process.

Real-Life Applications of AI (Additional Questions)

96. How does AI contribute to education?


AI personalizes learning, automates administrative tasks, and enables intelligent
tutoring systems.

97. What is the role of AI in transportation?


AI powers self-driving cars, optimizes traffic management, and improves logistics.

98. How is AI used in financial services?


AI detects fraud, predicts stock trends, and provides personalized financial advice.

99. What are AI’s contributions to environmental conservation?


AI monitors wildlife, predicts natural disasters, and optimizes energy usage.

100. Explain how AI is transforming the entertainment industry.


AI powers content recommendations (e.g., Netflix), enhances visual effects, and
creates virtual actors.
Advanced Python Class 10 Important Questions
Class 10 AI Advanced Python Important Questions
Important Questions of Advanced Python Class 10 – Class 10 Advanced Python Important Questions

Advanced Python Class 10 Subjective Questions

Question 1.
What is Jupyter Notebook?
Answer:
Jupyter Notebook is an open-source web application that allows users to create and share interactive documents containing live
code, equations, visualizations, and text. It’s particularly popular in AI-related projects and primarily uses Python, although it
supports other programming languages too.

Question 2.
How to access Jupyter Notebook?
Answer:
To access Jupyter Notebook:

1. Install Anaconda.
2. Open Anaconda Navigator.
3. Launch Jupyter Notebook from the Navigator interface or by using the Anaconda Prompt with the command jupyter notebook.

Question 3.
What is Virtual Environment?
Answer:
A virtual environment in Python is a self-contained directory that houses a Python interpreter and its own set of libraries and
dependencies. It allows developers to work on multiple projects with different dependencies without conflicts.

Question 4.
What are the key features of Python? Mention various applications along with it.
Answer:
Refer to text on page 102 (Features of Python, Python Applications).

Question 5.
What is a Jupyter Notebook ?
Answer:
Refer to text on page 100 (Jupyter Notebook).

Question 6.
How can install jupyter notebook in anaconda prompt?
Answer:
Refer to text on page 100 (Installing Jupyter Using Anaconda)

Question 7.
Why do we need to install a kernel before running jupyter notebook?
Answer:
We need to install a kernel before running Jupyter Notebook because:

1. Language Execution It allows Jupyter to execute code in a specific programming language.


2. Runtime Environment The kernel provides the necessary environment to run and manage code.
3. Interactive Computing It facilitates communication between the notebook interface and the code execution process.
4. Output Handling The kernel processes code execution and returns outputs, including results and error messages, to the
notebook.

Advanced Python Class 10 Very Short Answer Type Questions

Question 1.
What is the output of print(type(25))?
Answer:
The output is <class ‘int’>.

Question 2.
Give one example of variable.
Answer:
age = 25, where age is the variable storing the value 25 .

Question 3.
Define Pandas libraries.
Answer:
Pandas is an open-source data manipulation and analysis library for Python. It provides data structures like DataFrame for efficient
data handling.

Question 4.
Define operator precedence.
Answer:
Operator precedence determines the order in which operators are evaluated in an expression. It ensures that certain operators are
evaluated before others.

Question 5.
Give one example of each of the following:
(a) Unary operator
(b) Comparison operator

(a) Unary operator: ∼ x (negation)


Answer:

(b) Comparison operator: = (equality)

Question 6.
Mention any one feature of List in Python.
Answer:
Lists in Python are versatile and can store elements of different data types in an ordered and mutable sequence.

Question 7.
What do you understand by iteration in programming?
Answer:
Iteration is the process of repeatedly executing a set of statements or a block of code.

Question 8.
Give any two features of OpenCV.
Answer:
Two features include image recognition and object detection.

Question 9.
Name the operator used for the following:
(a) To assign a value to a variable
(b) That returns True or False.
Answer:
(a) =
(b) Comparison operators, such as == or ! =

Question 10.
What is the minimum number of iterations that while loop could make?
Answer:
while loop could make minimum 0 iteration.

Advanced Python Class 10 Short Answer Type Questions

Question 1.
Identify and correct the error(s) from the given below variables.
(i) STD
(ii) 5STD
(iii) D
(iv) (Marks)
Answer:
(i) Error STD – – is not allowed. The correct form is STD
(ii) Error 5STD First character must be alphabet. The correct form is STD5.
(iii) Error D$$ is not allowed. The correct form is D.
(iv) Error (Marks) Brackets are not allowed. The correct form is Marks.

Question 2.
Differentiate between identifier and keyword.
Answer:
Differences between identifier and keyword are as follows

Identifier Keyword

Identifier consists any combination of letters,


Keyword must consist only letters.
numbers and underscores.

It allows both uppercase and lowercase. It allows only lowercase.

e.g. x, sum_5,_mul etc. e.g. finally, continue, yield etc.

Question 3.
What is the difference between statement and expression?
Answer:
Differences between statement and expression are as follows

Statement Expression

A statement is a complete line of code that An expression is any section of the code that evaluates

performs some action. to a value.

Statements can only be combined vertically by Expressions can be combined horizontally into larger

writing one after another or with block constructs. expressions using operators.

Question 4.
Shreya is programming in Python and writing a following code. But she found an error, what is the reason?
a = 10
b = 20
c=a+b
print (“The output is : ” , c)
Answer:
The above code is identation error and correct code is
a = 10
b = 20
c=a+b
print (“The output is : “, c)

Question 5.
Find the syntax error in the following program and underline after correct them.
w = 90 ;
while (w>60)
pringt (w)
w = w-50
Answer:
Correct code is

Question 6.
Construct logical expressions to represent the following conditions.
(i) Weight is greater than or equal to 115 but less than 125.
(ii) Donation is in the range of 4000-5000 or Guest is 1.
Answer:
(i) (weight >=115 and weight <125 )
(ii) ((Donation >=4000 and Donation <=5000 ) or Guest ==1 )

Question 7.
Write a Python program to calculate simple interest and display it.
Answer:

Output
Enter the principal : 5000
Enter rate of interest : 10
Enter time: 2
The simple interest is 1000.0

Question 8
What is a Python package?
Answer:
A Python package is a way of organising related modules into a single directory hierarchy. It helps in structuring Python’s module
namespace and avoids naming conflicts. Packages are directories containing module files and an __init__py file. They provide a
means of creating a hierarchical structure to organise and distribute Python code.

Advanced Python Class 10 Long Answer Type Questions

Question 1.
What do you understand by string literals? Explain.
Answer:
The literal which is stored in a variable within single quotation mark or double quotation marks is called string literal. These
represent a sequence of zero or more characters enclosed by double quotes. It can also include blank spaces.
Some valid string constants are
Some Invalid string constants are

Neha – Not enclosed in double or single quotes


“Hello” – Number of quotes must be even either double or single.

There are two types of strings supported in Python:


(a) Single Line String Strings that are terminated within a single line are known as single line strings.
e.g. >>> value = ‘Arihant’
(b) Multiline String A piece of text that is spread along multiple lines is known as multiple line string.
There are two ways to create multiline strings:
(I) Adding backslash at the end of each line

(II) Using triple quotation marks

Question 2.
Write a Python program with output to convert the centimeter value into meter and kilometer.
Answer:

Output
Enter value in centimeters: 5000
Length in meter = 50.0 m
Length in Kilometer = 0.05 km

Question 3.
An electricity board charges according to the following rules.
For the first 100 units – 40 P per unit
For the next 200 units – 50 P per unit
Beyond 300 units -60 P per unit
All users have to pay meter charge also, which is ₹ 50. Write a program to read the number of units consumed and print out the
charges.
Answer:
Output
Enter the number of units consumed: 125
The charges is : 102.5

Question 4.
Write a program to check whether a number is prime or not.
Answer:

Output
Enter the number : 67
n = 67
67 is a prime number

Question 5.
Write a program in Python to accept monthly salary from the user, find and display income tax with the help of following rules.

Monthly Salary Income Tax

9000 or more 40 % of monthly salary


7500-8999 30 % of monthly salary

7499 or less 20 % of monthly salary

Answer:

Output
Enter monthly salary: 15000
Income tax is 6000.0

Question 6.
Write a Python program which enter the cost price and selling price of an item and find profit or loss.
Answer:

Output
Please Enter the Cost Price of an Item: 15000
Please Enter the Selling Price of an Item: 17500
Total Profit = 2500.0
Class 10 AI Advanced Python Notes
Jupyter Notebook Class 10 Notes
A Jupyter Notebook 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.

Installing Jupyter Using Anaconda Class 10 Notes


By creating separate Python virtual environments for each project

1. To install Python virtual environment – JUPYTER Notebook using ANACONDA, type the link:
https://www.anaconda.com/products/individual
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.

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.

From the New, select Console.

Getting Familiar With Jupyter Notebook


Let’s get familiar with the components of Jupyter Notebook
I. The Notebook Dashboard: The Notebook dashboard has two tabs.
(a) Files – All the programs that are saved earlier can be visualised under this section. The extension of these files is .ipynb.
(b) Running – All notebooks that are opened presently can be seen under this tab.

II. Notebook Kernel: The programs that we save on the notebook gets run with the help of an in-built interpreter. Kernel executes the
code and shows the result.
The window of the Jupyter notebook has the following parts:

Introduction To Python Class 10 Notes

 Python is a versatile and high-level programming language known for its readability and simplicity. It is created by Guido van
Rossum.
 Python supports multiple programming paradigms, including Procedural, Object-Oriented, and Functional Programming. It has
a comprehensive standard library and a vast ecosystem of third-party packages.
 Its syntax promotes clean and concise code, contributing to increased productivity.

Features of Python

Here are some key features of the Python programming language:


Readability: Python’s syntax is designed to be clear and readable, promoting a more straightforward and maintainable codebase.

Easy to Learn and Use: Python’s simplicity and readability make it an ideal choice for beginners. It has a shallow learning curve,
allowing developers to quickly grasp the basics and start coding.
Expressive Language: Python allows developers to express concepts in fewer lines of code than other languages like C++ or Java.

Interpreted Language: Python is an interpreted language, which means that code can be executed directly without the need for
compilation.

Dynamic Typing: Python uses dynamic typing, allowing developers to create flexible and adaptable code.

Large Standard Library: Python comes with a comprehensive standard library that includes modules and packages for various
purposes, such as web development, data manipulation, networking, and more.

Community Support: Python has a large and active community of developers. This results in a wealth of resources, tutorials, and
third-party libraries that can be easily accessed, contributing to problem-solving and collaborative development.

Cross-Platform Compatibility: Python is platform-independent, meaning that Python code can run on various operating systems
without modification.

Object-Oriented Programming Python supports Object-Oriented programming, allowing developers to create and use classes and
objects, promoting modularity and code reuse.

Integration Capabilities: Python can be easily integrated with other languages like C and C++, enabling developers to use existing
code and libraries.

Databases: Python provides interfaces to many commercial and open-source databases, making it a suitable choice for database
applications.

Scalability: Python is scalable, making it applicable for small scripts as well as large projects.

Python Applications

Here, we are specifying application areas where Python can be applied.

 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, beautifulSoup, 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.

Python Basics Class 10 Notes


Python as a programming language was introduced in class 9. Let us now do a quick recap of some important concepts and syntax
necessary for writing a program.

Python Character Set

Character set is a set of valid characters that a language can recognise. A character represents any digit, alphabet and special
symbol. The character used in a Python source program belongs to unicode standard.
Python supports the following character set.
Alphabets – A to Z (uppercase), a to z (lowercase)
Digits – 0 to 9
Other Characters Python can process any of the ASCII and unicode characters as data or as literals

Identifiers

The identifier is a sequence of characters taken from Python character set.


Identifiers are used to give the name to data items like variables, objects, classes, functions, arrays, etc., to specify their names.

The rules in Python for identifiers are

1. Only alphabets, digits and underscores are permitted.


2. Identifier name cannot start with a digit.
3. Keywords cannot be used as identifier.
4. Uppercase and lowercase letters are distinct because Python is case sensitive language.
5. Special characters are not allowed.

e.g. Name, name_1, FirstName etc.

Keywords

Keywords are predefined reserved words by the programming language that have some special or predefined meanings. These are
reserved for special purpose and must not be used as identifier names. Some commonly used keywords in Python, which are listed
below:

Operators

Operators perform a specific task/computation when applied on variable or some other objects in an expression (known as
operands). Operators are used in programs to operate on data and variables.
There are two types of operators as follows:

(i) Unary Operators

Those operators that work on single operand to form an expression are known as unary operators.
Following are some unary operators:
(ii) Binary Operators

Operators that work upon two operands are known as binary operators.
There are various types of binary operators in Python as follows.
(a) Arithmetic operators These operators are used to do arithmetic operations. These operators are

(b) Logical operators These operators are used to make a decision on two conditions. Logical operators are typically used with
boolean values and what they return is also a boolean value. These operators are

(c) Relational operators Relational operators compare two operands to one another. These operators are

(d) Assignment operators Assignment operators are used to assign the value of an expression to a variable. These operators are
(e) Bitwise operators Bitwise operators work on bits and perform bit by bit operation. These operators are

(f) Shift operators These operators are used to shift value left or right. These operators are

(g) Identity operators These operators are

(h) Membership operators These operators are

Expressions

An expression is a combination of operators, constants and variables as per rule of the language. Any part in a program which can
have a value, is an expression. It will have operands and operators together to produce a value.
Statements

A statement is a logical instruction, which Python interpreter can read and execute. In Python, it could be an expression or
assignment statement. The assignment statement is fundamental to Python.

when expression will be evaluated, statement or group of statements executed.

Comments

Comments are non-executable statements that are ignored by the interpreter or compiler and are not executed by the computer.
Comments are written to explain what each block of the program is doing.
There are two types of comments used in programs as follows
(a) Single line comment A single line comment starts with symbol.
e.g. Here is define the function of addition
(b) Multi-line comment A multi-line comment starts with a “‘symbol and ends with”.
e.g. x = 20 “Here we initialise the value of variable x as 20 “‘

Indentation

Indentation indicates the relationship between various statements and thus allow us to get a better picture of the overall organisation
and structure of the solution given in the program. It improves the readability of the program.

This is block with all its statements same indentation.

Variables Class 10 Notes


Variable is a container object that stores a meaningful value that can be used throughout the program.
Each variable has a specific type, which determines the size and layout of the variable’s memory, the range of values that can be
stored within that memory and the set of operations that can be applied to the variable.
A variable can be created anywhere in Python program.

Above is an assignment statements which used to assign values to variables.

Dynamic Typing Class 10 Notes


Python is a dynamically type language. It does not know about the type of the variable until the code is run, so declaration is not
used. It stores that value at some memory location and then binds that variable name to that memory container. We have assigned
a value to variable.

>>> a = 10

But to find the type of this variable, use the type () module Syntax
type (variable_name)
To find the type of above variable, we use
Input and Output in Python Class 10 Notes

Input/Output or I/O is the communication between information processing system (such as a computer) and the outside world,
possibly a human or another information processing system.
Inputs are the data received by the user, and outputs are the data sent to user. In almost every computer program, the user has to
input some data that will be stored in computer’s memory and then subsequently processed. And finally, there is need to output the
results of the computations. The output can be displayed on the computer screen.

Input Statement
Python has an input() function which lets you ask a user for some text input.
input( ) function first takes the input from the user and then evaluates the expression, which means Python automatically identifies
wifether user entered a string or number or list.

If the input provided is not correct, then either syntax error or exception is raised by Python.

Output Statement
To output your data to the screen, use the print () function. print() function gives output an entire (complete) line and then goes to
next line for subsequent output. To print more than one item on a single line, comma (.) may be used.

Data Types Class 10 Notes


Data types are the classification or categorisation of data items. It represents the kind of value that tells what operations can be
performed on a particular data. The following are the standard or built-in data types in Python:
Numeric

The numeric data type in Python represents the data that has a numeric value. A numeric value can be an integer, a floating
number, or even a complex number. Numeric data type is further classified into three categories.

 Integers This value is represented by int class. It contains positive or negative whole numbers (without fractions or decimals).
 Float This value is represented by the float class. It is a real number with a floating-point representation. It is specified by a
decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific
notation.
 Complex Numbers A complex number is represented by a complex class. It is specified as (real part) + (imaginary part)j. For
example -2+3 j

Dictionary

A dictionary is a key-value pair set arranged in any order. It stores a specific value for each key, like an associative array or a hash
table. Value is any Python object, while the key can hold any primitive data type.
The comma ( , ) and the curly braces are used to separate the items in the dictionary.

Boolean
Data type with one of the two built-in values, True or False is known as booléan data type. Boolean objects (True or False) are
denoted by the class bool.

Set
It is iterable, mutable(can change after creation), and has remarkable components. The elements of a set have no set order.

Sequence
The sequence data type is the ordered collection of similar or different Python data types. Sequences allow storing of multiple
values in an organised and efficient manner.
There are several sequence types in Python –

 String : The sequence of characters in the quotation marks can be used to describe the string. A string can be defined using
single, double, or triple quotes.
 List : Lists in Python can contain data of different types. Elements of lists are separated with comma (.) and enclosed inside
square bracket [].
 Tuple : Tuples, like lists, also contain a collection of items from various data types. A parenthetical space () separates the
tuple’s components from one another.
Control Structure Class 10 Notes
A control structure is a programming language construct which affects the flow of the execution of program.
Various types of control structure are described below

Sequence Statements
Sequence statement refer to the instructions that are executed in the sequence in which they are written in the program. When a
program is run, the CPU begins execution, executes some number of statements and then terminates at the end.
For example

Output
A program which adds two integers
Enter first integer : 5
Enter second integer: 11
Sum is : 16
Selection Statements
These statements allow a program to execute a statement or a set of statements depending upon a given condition. These
statements are also called conditional statements or decision statements.
Python provides three types of selection statements are described below:

1. If statement

The if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of
statements will be executed or not.
Output
x is greater

2. if-else statement

This statement also tests a conditional expression. If the condition is true, the entire block of statements following the if block and it
will be executed.
Otherwise, the entire block of statements following the else block and it will be executed.

Output
we are in else part because x is not greater

3. if-elif-else statement

Sometimes, we need to execute different statement to perform in different conditions. It requires the evaluation of several
conditions.
First of all, the first condition is evaluated, if it is true then respective statements are processed. Otherwise, the next condition is
evaluated to process another say of statements. This process is continued for several times.
Expression is tested from the top towards the downside. As soon as the true condition is found, the associated set of statement is
executed.
x=55

Output
Divisible by 5

4. Nested if statement

Nested means if statement or if-else statements are placed in the statement block of if statement or else statement.
Output
result =15

The nested if can have one of the following four forms:


(i) if nested inside both, if part and else part

(ii) if nested inside if part

(iii) if nested inside else part

(iv) One if inside another if statements


range( ) Function

The range( ) function is used to generate a sequence of numbers overtime. At its simplest, it accepts an integer and returns a range
object (a type of iterable).

The range ( ) function has two forms as follows:


(i) range (stop)
stop number of integers to generate, starting from zero. e.g. range (5) = [0,1,2,3,4]

(ii) range ([start,] stop [,step])

 start starting number of the sequence.


 stop generate numbers upto, but not including this number.
 step difference betweèn each number in the sequence.

Iterative Statements

Iterative statements or loops enable a program with a cyclic flow of logic. Each statement which is written under the scope of a
looping statement gets executed the number of times the iteration/looping continues for. There are two basic types of looping
statements available in Python, they are as follows.

1. while loop

A while loop tests for its ending condition before executing the statements enclosed in the loop body even the first time.
So, if the ending condition is met when the while loop beings, the lines of instructions its contains will never be carried out. This loop
is also known as Entry control loop.

A while loop continues iteration cycle till its loop condition is evaluated as true. If the loop-condition is false for the first time iteration,
then loop will not execute even once.

Output
Enter a natural number : 10
Sum is : 55

2. for loop

The for statement encloses one or more statements that form the body of the loop, the statements in the loop repeat continuously a
certain number of times.
This loop is also an entry control loop, as condition is checked before entering into the scope of the loop.
Output
A
B
A
B
A
B
A
B

Python Packages Class 10 Notes


Python has a rich ecosystem of libraries and packages that extend its functionality for various purposes. Here are some widely used
Python libraries and packages:

 NumPy It provides support for large, multi-dimensional arrays and matrices, along with mathematical functions to operate on
these arrays. Usage Data science, machine learning, scientific computing.
 Pandas It offers data structures like DataFrame for efficient data cleaning, exploration, and analysis. Usage Data analysis,
data cleaning, data manipulation.
 Matplotlib Comprehensive 2D plotting library. It allows the creation of static, animated, and interactive visualizations in Python.

Usage Data visualization, plotting graphs.


Scikit-learn Machine learning library built on NumPy, SciPy, and Matplotlib. It provides simple tools for data mining and data
analysis.

Usage Machine learning, data mining,

 Beautiful Soup Library for pulling data out of HTML and XML files. It provides Pythonic idioms for iterating, searching, and
modifying the parse tree. Usage Web scraping.
 Django High-level web framework for building web applications quickly. It follows the model-view-controller (MVC) architectural
pattern. Usage Web development.
 Flask Lightweight web framework. It simplifies web application development by providing tools and libraries needed.

Usage Web development.

 NLTK (Natural Language ToolKit) Library for working with human language data. It provides easy-to-use interfaces for tasks
such as classification, tokenization, stemming, tagging, parsing, and more.
 Usage Natural Language Processing (NLP), text mining.
 OpenCV (Open Source Computer Vision) Library for computer vision and machine learning. It provides tools for image and
video analysis.
 Usage Computer vision, image and video processing.

Glossary :

 Jupyter Notebook It is a powerful tool widely used in the field of data science, research, and education Jupyter Notebooks
support various programming languages, but it is most commonly associated with Python.
 Virtual Environment It is a self-contained directory that encapsulates a specific Python interpreter and its associated libraries.
 Package It is a collection of Python modules organised in a directory hierarchy.
 Keywords They are reserved words that have special meanings and cannot be used as identifiers.
 Identifiers They are names used to identify variables, functions, classes, modules, or other objects in the code.
 Conditional statement it allows you to control the flow of program based on certain conditions.
 Loops They are used to repeatedly execute a block of code until a specified condition is met.

You might also like