slip.8
(Save by .html
<form method="POST" action="setb1ph.php">
<label for="smallString">Small String:</label>
<input type="text" name="smallString" id="smallString" required>
<label for="bigString">Big String:</label>
<input type="text" name="bigString" id="bigString" required>
<input type="submit" value="Submit">
</form>
(Save by . setb1ph.php)
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$smallString = $_POST["smallString"];
$bigString = $_POST["bigString"];
// a. Find whether the small string appears at the start of the large string
$startsWith = (strpos($bigString, $smallString) === 0);
// b. Find the position of the small string in the big string
$position = strpos($bigString, $smallString);
// c. Compare both strings for the first n characters (case insensitive)
$n = 5; // Change this value to the desired number of characters to compare
$comparison = strncasecmp($smallString, $bigString, $n);
// Output the results
echo "Starts with small string: " . ($startsWith ? "Yes" : "No") . "<br>";
echo "Position of small string: " . ($position !== false ? $position : "Not found") .
"<br>"; echo "Comparison of first $n characters: " . ($comparison == 0 ? "Equal" :
"Not equal") . "<br>";
}
?>
2...
import pandas as pd
import numpy as np
import scipy.stats as s
from sklearn import preprocessing
data = pd.read_csv('winequality-red.csv')
print("\n Initial Mean : ", s.tmean(data).round(2))
print("\n Initial Standard Deviation :\n ", round(data.std(), 2))
standard = preprocessing.scale(data)
standard.mean(axis=0)
standard.std(axis=0)
print("\n*** Standardized Data ***\n", standard.round(2))
print("\n Scaled Mean : ", s.tmean(standard).round(2))
print("\n Scaled Standard Deviation : ", round(standard.std(), 2))
Comments
Post a Comment