0% found this document useful (0 votes)
9 views6 pages

Practical Question

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Practical Question

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Practical Examination Term I 2021-22

Lab Course- II (Web Technologies I, Foundations of Data Science)

Name:- shivani dattatray sarangkar


Class:- TYBCS
Roll no.:-3340

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;">

<form style="margin:10% 30%;" action="phpfile.php"


method="POST">
<h2>Result</h2>
<label for="num1"> 1. sub-php Mark :</label>
<input type="number" id="num1" name="val1"
placeholder="Enter sub 1 mark">
<br><br>
<label for="num2">2. sub-java Mark :</label>
<input style="" type="number" id="num2" name="val2"
placeholder="Enter sub 2 mark">
<br><br>
<label for="num3">3. sub-python Mark :</label>
<input style="" type="number" id="num3" name="val3"
placeholder="Enter sub 3 mark">
<br><br>
<label for="num4">4. sub-SQL Mark :</label>
<input style="" type="number" id="num4" name="val4"
placeholder="Enter sub 4 mark">
<br><br>
<label for="num5">5. sub-FDS Mark :</label>
<input style="" type="number" id="num5" name="val5"
placeholder="Enter sub 5 mark">
<br><br>

<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:-

You might also like