OneCompiler

Hslip13

103

Q1]

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Chess Board</title> <style> table { border-collapse: collapse; }
    td {
        width: 50px;
        height: 50px;
        text-align: center;
        font-size: 20px;
        border: 1px solid black;
    }

    .black {
        background-color: #696969;
        color: white;
    }

    .white {
        background-color: #f0f0f0;
    }
</style>
</head> <body> <table> <?php // Loop to create a 8x8 chess board for ($row = 1; $row <= 8; $row++) { echo "<tr>"; for ($col = 1; $col <= 8; $col++) { // Determine if the cell should be black or white based on row and column $class = ($row + $col) % 2 == 0 ? 'white' : 'black'; echo "<td class='$class'></td>"; } echo "</tr>"; } ?> </table> </body> </html>

Q2]
A]
import pandas as pd
import matplotlib.pyplot as plt

Load Iris dataset

iris_data = pd.read_csv('iris.csv')

Plotting the relationship between petal length and petal width

plt.figure(figsize=(8, 6))
plt.scatter(iris_data['petal_length'], iris_data['petal_width'], color='blue', alpha=0.7)
plt.title('Relationship between Petal Length and Petal Width')
plt.xlabel('Petal Length (cm)')
plt.ylabel('Petal Width (cm)')
plt.grid(True)
plt.show()

B]
import numpy as np

Example flattened array

flattened_array = np.array([5, 2, 9, 1, 7, 3, 8, 4])

Find maximum and minimum values

max_value = np.max(flattened_array)
min_value = np.min(flattened_array)

print("Flattened Array:", flattened_array)
print("Maximum Value:", max_value)
print("Minimum Value:", min_value)