Hslip4
Q1]
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>List of Books</title> <style> table { width: 50%; border-collapse: collapse; margin: 20px auto; }th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: center;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>List of Books</h2>
<table>
<tr>
<th>Item No</th>
<th>Item Name</th>
<th>Price</th>
</tr>
<tr>
<td>1</td>
<td>Programming in Python</td>
<td>500<span style="font-size: smaller;">.50</span></td>
</tr>
<tr>
<td>2</td>
<td>Programming in Java</td>
<td>345<span style="font-size: smaller;">.00</span></td>
</tr>
</table>
</body>
</html>
Q2]
a]
import numpy as np
import matplotlib.pyplot as plt
Generate a random array of 50 integers
random_array = np.random.randint(1, 100, 50)
Line chart
plt.figure(figsize=(10, 4))
plt.plot(random_array, marker='o', color='blue')
plt.title('Line Chart of Random Array')
plt.xlabel('Index')
plt.ylabel('Value')
plt.show()
Scatterplot
plt.figure(figsize=(10, 4))
plt.scatter(range(1, 51), random_array, color='green', marker='x')
plt.title('Scatterplot of Random Array')
plt.xlabel('Index')
plt.ylabel('Value')
plt.show()
Histogram
plt.figure(figsize=(10, 4))
plt.hist(random_array, bins=10, color='orange', edgecolor='black')
plt.title('Histogram of Random Array')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.show()
Box plot
plt.figure(figsize=(6, 4))
plt.boxplot(random_array, vert=False)
plt.title('Box Plot of Random Array')
plt.xlabel('Value')
plt.show()
Q2]
B]
import pandas as pd
Assuming the dataset is named 'User_Data.csv'
data = pd.read_csv('User_Data.csv')
Print the shape of the data
print("Shape of the data:", data.shape)
Print the number of rows and columns
print("Number of rows:", data.shape[0])
print("Number of columns:", data.shape[1])
Print data types of each column
print("\nData types:")
print(data.dtypes)
Print feature names
print("\nFeature names:")
print(data.columns)
print("\nDescription:")
print(data.describe())