Page 214 - Robotics and AI class 10
P. 214
plt.xticks([1, 2, 3, 4], ["Eng", "Maths", "Science", "SSt"], rotation=10)
plt.boxplot(box_plot_data)
plt.title('Box Plot')
plt.xlabel('Subjects')
plt.ylabel('Marks')
plt.show()
Output :
Box Plot
100
80
60
40
20
1 2 3 4
Subjects
Understanding Libraries in Python, and the Syntax of Importing Libraries
Python libraries are pre pre-written set of code which gives additional functionality and tools to enhance the
capabilities of Python. They are collections of pre-defined modules and packages that provide some built-in
functions, classes, and methods for various tasks. It saves the programmers time and effort by providing solutions
to some common problems and allowing them to use it in the existing code.
Some of the major advantages of using Python libraries are:
• Code Reusability: Since libraries have built in functions and modules which can directly be used in a program,
it provides the feature of reusing the code as and when needed by a programmer.
• Extended Functionality: These libraries are created and maintained by experts in their respective fields, providing
robust and efficient implementations. These are some additional features that enhance the functionality of
the Python standard library. For example some of the libraries provide features like scientific computing, web
development, data analysis, machine learning, and many more.
• Efficiency and Performance: Due to the reusability of the code it saves the time and the effort of the programmer
which can significantly improve the execution speed and efficiency of a program.
• Domain-Specific Solutions: Python libraries provide important tools and utilities that work as a backbone to
various domains and industries. For example, NumPy is a library for numerical computing, Pandas is used for
data analysis, Django is a web development framework, and TensorFlow is focused on machine learning.
The import statement is used to bring a library into Python code.
Let us do some of examples:
Example 1
Few examples of using Python library - math for mathematical related functions:
>>> import math
212 Touchpad Robotics & Artificial Intelligence-X

