Posts

Slip 22

1 <?php $queue = array(); while (true) {     echo "\n====== Queue Operations ======\n";     echo "1. Insert an element in Queue\n";     echo "2. Delete an element from Queue\n";     echo "3. Display Queue\n";     echo "4. Exit\n";     echo "Enter your choice: ";     $choice = trim(fgets(STDIN));     switch ($choice) {         case 1:             echo "Enter element to insert: ";             $element = trim(fgets(STDIN));             array_push($queue, $element);             echo "Inserted: $element\n";             break;         case 2:             if (empty($queue)) {                 echo "Queue is empty. Cannot delete.\n";       ...

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 "Modulu...

slip.9

1.. Save by . html) <html> <body bgcolor=#c29bb8> <form action="setb2ph1.php" method=get> <pre> Enter any string:<input type=text name=s> Select seperator from following:<select name=s1>  <option> | </option> <option> @ </option> <option> # </option> </select> <input type=submit value=show_output> </pre> </form> </body> </html> ************setb2ph.php*********** <html> <body bgcolor="#67074e"> <?php $str = $_GET['s']; $separator = $_GET['s1']; echo "<br>Given String: $str"; $arr=explode($separator,$str); $words=implode(" ",$arr); echo "<br> String into words: $words"; $str_rep=str_replace($separator,'#',$str); echo "<br>After Replacement: $str_rep"; $lpos=strrpos($str," "); echo "<br>last word in given string:" .sub...

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 ins...

slip.7

<!DOCTYPE html> <html> <head> <style> ul { list-style: none; margin: 2px; padding: 3px; } ul li { float: left; padding: 10px; background: orange; text-align: center; margin-left: 5px; } ul li:hover { background: red; opacity: 0.8; color: white; } a { text-decoration: none; color: black; } </style> </head> <body> <h2>List of Books</h2> <ul> <li><a href="#">Home</a></li> <li><a href="#">Java</a></li> <li><a href="#">HTML</a></li> <li><a href="#">CSS</a></li> </ul> </body> </html> 2 import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from sklearn import preprocessing data = pd.read_csv('Data.csv') df = pd.DataFrame(data) print('\n Displaying Dataset : \n\n', df) enc = preprocessing.OneHotEncoder() enc...

slip.6

1..... <!DOCTYPE html> <html> <head> <title>Layout Example</title> <style> body { margin: 0; font-family: Arial, sans-serif; } header { background-color: #2a6ebd; color: white; padding: 20px; text-align: center; } nav { background-color: #36b5b0; width: 25%; float: left; padding: 20px; height: 400px; box-sizing: border-box; } section { background-color: #f3a41c; width: 75%; float: left; padding: 20px; height: 400px; box-sizing: border-box; } footer { clear: both; background-color: #e33c3c; color: white; text-align: center; padding: 15px; } </style> </head> <body> <header> <h1>Header</h1> </header> <nav> <h2>Menu</h2> </nav> <section> <p> Write one pragragh of 5 lines </p> </section> <footer> <p>Footer</p> </footer> </body> </html> 2.... import pandas as pd import matplotlib.pyplot as plt data = pd.read_csv('Data.csv') ...

slip.5

1. <!DOCTYPE html> <html lang="en">  <head>  <title>Bootstrap Example</title>  <meta charset="utf-8">  <meta name="viewport" content="width=device-width, initial-scale=1">  <link rel="stylesheet"  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.c  ss">  <script  src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></scrip  t>  <script  src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js">  </script>  </head>  <body>  <div class="jumbotron text-center">  <h1>My First Bootstrap Page</h1>  <p>Resize this responsive page to see the effect!</p>  </div>  <div class="container">  <div class="row"> <div class="col-sm-4">  <h3>Personal Information</h3> <p>Add yo...