Practical Question
Practical Question
Slip 6
PHP Question
Q.1 Write a PHP script for the following: Design a form to accept the marks of
5 different subjects of a student, having serial-number, subject-name & marks
out of 100. Display the result in the tabular format which will have total,
percentage and grade. Use only 3 text boxes.
(Use array of form parameters)
Answer:-
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>practicle assign</title>
</head>
<body style="background:#2dd2cc;">
<input style="margin-
left:100px;color:#fff;background:#f44336;" type="submit"
value="Answer">
</form>
</body>
</html>
Php code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Document</title>
</head>
<body style="background:#2dd2cc; margin:10% 30%;">
<?php
$num11= $_POST["val1"];
$num22= $_POST["val2"];
$num33= $_POST["val3"];
$num44= $_POST["val4"];
$num55= $_POST["val5"];
$total=$num11+$num22+$num33+$num44+$num55;
echo "<br> Total marks : ".$total."/ 500";
$percentage = ($total/500.0)*100;
echo "<br> percentage : ". $percentage;
echo "<br> <br>";
echo "Grade : ";
switch($percentage){
case $percentage>=100 && $percentage>=90;
echo "A Grade";
break;
case $percentage>=80 && $percentage<=89;
echo "B Grade";
break;
case $percentage >=70 && $percentage<=79;
echo "C Graade";
break;
case $percentage >=60 && $percentage<=69;
echo "D Grade";
break;
case $percentage >= 50 && $percentage<=59;
echo "E Grade";
break;
case $percentage>=40 && $percentage<=49;
echo "F Grade";
break;
case $percentage>=34;
echo "FAIL";
}
?>
</body>
</html>
OUTPUT:-
Foundation of data Science question
Q.2 Write a Python program to create a Pie plot to get the frequency of the three species of
the Iris data. (Student must use Iris flower data set )
Answer:-
import pandas as pd
import matplotlib.pyplot as plt
iris = pd.read_csv("iris.csv")
ax=plt.subplots(1,1,figsize=(10,8))
iris['Species'].value_counts().plot.pie(explode=[0.1,0.1,0.1],autopc
t='%1.1f%%',shadow=True,figsize=(10,8))
plt.title("Iris Species %")
plt.show()
output:-