Hslip16
Q1]
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Student Result Form</title> </head> <body> <form method="post" action="process_result.php"> <?php for ($i = 1; $i <= 5; $i++) { echo "<label for='subject{$i}'>Subject {$i}:</label>"; echo "<input type='text' name='subject_name[]' placeholder='Subject Name'>"; echo "<input type='number' name='marks[]' placeholder='Marks' min='0' max='100' required>"; echo "<br>"; } ?> <input type="submit" value="Submit"> </form> </body> </html>Q2]a]
import matplotlib.pyplot as plt
Create two lists representing subject names and marks
subject_names = ['Math', 'Science', 'English', 'History', 'Geography']
marks_obtained = [90, 85, 88, 92, 78]
Display the data in a pie chart
plt.figure(figsize=(12, 5))
plt.subplot(1, 2, 1)
plt.pie(marks_obtained, labels=subject_names, autopct='%1.1f%%', startangle=90, colors=['#ff9999', '#66b3ff', '#99ff99', '#ffcc99', '#c2c2f0'])
plt.title('Subject-wise Marks Distribution')
Display the data in a bar chart
plt.subplot(1, 2, 2)
plt.bar(subject_names, marks_obtained, color=['red', 'blue', 'green', 'orange', 'purple'])
plt.title('Subject-wise Marks Distribution')
plt.xlabel('Subjects')
plt.ylabel('Marks')
plt.tight_layout()
plt.show()
B]
import pandas as pd
Create a data frame for students' information
data = {'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Emma'],
'GraduationPercentage': [85.5, 92.3, 78.8, 88.2, 95.1],
'Age': [22, 23, 21, 24, 22]}
df = pd.DataFrame(data)
Display average age of students
average_age = df['Age'].mean()
print(f"Average Age of Students: {average_age}")
Display average of graduation percentage
average_percentage = df['GraduationPercentage'].mean()
print(f"Average Graduation Percentage of Students: {average_percentage}")