slip.10
1....
(Save by . html)
<!DOCTYPE html>
<html>
<body>
<form action="calculate.php" method="post">
<input type="text" name="num1" placeholder="Enter first number">
<input type="text" name="num2" placeholder="Enter second number">
<input type="submit" value="Calculate">
</form>
</body>
</html>
calculate.php
<?php
function findModulus($num1, $num2)
{
return $num1 % $num2;
}
function findPower($num1, $num2)
{
return pow($num1, $num2);
}
function findSum($n)
{
return ($n * ($n + 1)) / 2;
}
findFactorial($num)
{
if ($num === 0) {
return 1;
} else {
return $num * findFactorial($num - 1);
}
}
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$modulus = findModulus($num1, $num2);
$power = findPower($num1, $num2);
$sum = findSum($num1);
$factorial = findFactorial($num2);
echo "Modulus: " . $modulus . "<br>";
echo "Power: " . $power . "<br>";
echo "Sum of first " . $num1 . " numbers: " . $sum . "<br>";
echo "Factorial of " . $num2 . ": " . $factorial;
?>
2
import scipy.stats as s
import pandas as pd
import statistics as st
data = pd.read_csv("weight-height.csv")
df = pd.DataFrame(data)
print("\n\n Mean Median weight-height dataset:\n ")
print("\n\t Mean of Height:", s.tmean(df['Height']))
print("\n\t Median of Height: ", st.median(df['Height']))
print("\n\t Mean of Weight:", s.tmean(df['Weight']))
print("\n\t Median of Weight: ", st.median(df['Weight']))
from scipy.spatial import distance
p1 = [1, 2, 3, 4, 5, 6]
p2 = [10, 20, 30, 1, 2, 3]
manhattan_distance = distance.cityblock(p1, p2)
print('Manhattan distance between', p1, 'and', p2, 'is :', manhattan_distance)
Comments
Post a Comment