AI Finalized
AI Finalized
PROGRAM NO-1
Python Basics-1
AIM- Write a Python program to print the following string in a specific format.
SOURCE CODE-
print("Twinkle, twinkle, little star, \n\tHow I wonder what you are! \n\t\tUp
above the world so high, \n\t\tLike a diamond in the sky. \nTwinkle, twinkle,
little star, \n\tHow I wonder what you are!")
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
174
PROGRAM NO-2
Python Basics-2
AIM- Write a Python program to print 5 lines about yourself using print() function.
SOURCE CODE-
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
175
PROGRAM NO-3
Python Basics-3
176
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
177
PROGRAM NO-4
Python Basics-4
SOURCE CODE-
178
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
179
PROGRAM NO-5
Python Basics-5
AIM- A tours and travels company charges their customer as per following criteria according
to customer category.
Category Charges
A 18
B 15
C 12
D 10
Others 20
SOURCE CODE-
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
180
PROGRAM NO-6
LISTS AND ITS OPERATIONS
AIM- Write a Python program:-
1. To declare a list as num = [10, 30, 40, 20, 50] and print it.
2. To sort the list num in Ascending and the Descending order in Python.
3. To create a list as List1 = ['Hello', 10, 'world', 20] and iterate in reverse order.
4. To remove an element of List1 using List1.pop() .
5. To add an element to a List1 using List1.append().
SOURCE CODE-
RESULT- The source code is executed successfully and the output was verified.
182
PROGRAM NO-7
DATA SCIENCE
Data Visualization Tools
AIM- Write a short note about five essential plots that can help in data visualization and write a
Python program to show each.
Introduction: Data visualization is the process of turning your data into graphical
representations that communicate logical relationships and lead to more informed
decision-making.In short, data visualization is the representation of data in a graphical or pictorial
format.
There are five essential plots that have we need to know well for basic data visualization.
Line Plot
Bar Chart
Histogram Plot
Scatter Plot
Pie Chart
1. Line Plot:
A line plot is used to show observations gathered at regular intervals.
-axis shows the regular interval, such as time.
- axis shows the observations.
-
axis data for the regular interval, and Y axis for the observations.
# code to create a line plot
pyplot.plot(x, y)
2. Bar Plot:
A bar chart presents relative quantities for multiple categories.
The x-axis shows the categories that are spaced evenly.
The Y- axis shows the quantity for each category and is drawn as a bar from the baseline to
the required level on the Y-axis.
A bar chart can be built by the calling the bar() function and passing the category names for
the X-axis and the quantities for the Y axis.
3. Histogram Plot
Histogram plots are used for summarizing the distribution of a data sample.
The x-axis shows distinct bins or intervals for the observation.
The Y- axis shows the frequency or tally of the number of observations
in the dataset that has assigned to each bin.
A Histogram plot can be designed by the calling the hist() function and
passing a list or array that shows the data sample.
# code to create a histogram plot
pyplot.hist(x, y)
4. Scatter Plot:
A scatter plot can be designed by the calling the scatter() function and passing a list or
array that shows the data sample.
183
# code to create a scatter plot
pyplot. Scatter(x, y)
5. Pie Chart
A Pie Chart is a circular statistical plot that can display only one series of data.
The area of the chart is the total percentage of the given data. The area of slices of
the pie represents the percentage of the parts of the data
# code to create a pie plot
pyplot.pie(values, labels = Names)
SOURCE CODE-
184
185
OUTPUT-
186
RESULT- The source code is executed successfully and the output was verified.
187
PROGRAM NO-8
INTRODUCTION TO COMPUTER VISION
AIM- Write a Python program
a. To read and display an image using OpenCV in Google Colab.
b. To dsiplay the height and width of an input image.
c. To covert BGR format of OpenCV to RGB format.
Introduction:
Computer Vision Computer vision is a field/domain of artificial intelligence (AI) that enables
computers and systems to derive meaningful information from digital images, videos and other
visual inputs and take actions or make recommendations based on that information.
OpenCV-Python is a library of Python bindings designed to solve computer vision problems.
Python is a general purpose programming language started by Guido van Rossum that became
very popular very quickly, mainly because of its simplicity and code readability. It enables the
programmer to express ideas in fewer lines of code without reducing readability. OpenCV was
started at Intel in 1999 by Gary Bradsky, and the first release came out in 2000. Vadim Pisarevsky
joined Gary Bradsky to manage Intel's Russian software OpenCV team. In 2005, OpenCV was
used on Stanley, the vehicle that won the 2005 DARPA Grand Challenge.
SOURCE CODE-
# Importing the OpenCV library
import cv2
# Importing the matplotlib library
import matplotlib.pyplot as plt
188
OUTPUT-
RESULT- The source code is executed successfully and the output was verified.
189
PROGRAM NO-9
COMMON IMAGE MANIPULATION USING OpenCV
SOURCE CODE-
# Importing the OpenCV library
import cv2
# Importing the matplotlib library
import matplotlib.pyplot as plt
190