Posts

Featured Post

Write a Python function to count the occurrence of each element in a list.

 def count_elements(lst):     count_dict = {}     for element in lst:         if element in count_dict:             count_dict[element] += 1         else:             count_dict[element] = 1     return count_dict # Test the function my_list = [1, 2, 3, 2, 4, 1, 3, 4, 4, 5] element_count = count_elements(my_list) print(element_count)

Write a C++ program to calculate the factorial of a number using recursion.

 #include <iostream> using namespace std; int factorial(int n) {     if (n == 0) {         return 1;     }     return n * factorial(n - 1); } int main() {     int number = 5;     int result = factorial(number);     cout << "Factorial of " << number << " is: " << result << endl;     return 0; }

Write a Python function to check if a string is a palindrome.

 def is_palindrome(input_string):     input_string = input_string.lower().replace(" ", "")     reversed_string = input_string[::-1]     return input_string == reversed_string # Test the function my_string = "A man a plan a canal Panama" is_palindrome = is_palindrome(my_string) print(is_palindrome)

Write a Java program to find the maximum and minimum elements in an array.

 public class MaxMinArray {     public static void findMaxMin(int[] arr) {         int min = arr[0];         int max = arr[0];         for (int i = 1; i < arr.length; i++) {             if (arr[i] < min) {                 min = arr[i];             }             if (arr[i] > max) {                 max = arr[i];             }         }         System.out.println("Minimum: " + min);         System.out.println("Maximum: " + max);     }     public static void main(String[] args) {         int[] numbers = {5, 2, 9, 1, 7};         findMaxMin(numbers);     } }

Write a JavaScript function that checks whether a given number is prime or not.

 function isPrime(number) {   if (number <= 1) {     return false;   }   for (let i = 2; i <= Math.sqrt(number); i++) {     if (number % i === 0) {       return false;     }   }   return true; } // Test the function const num = 29; const isNumPrime = isPrime(num); console.log(isNumPrime);

Write a Python function to reverse a string without using any built-in functions or slicing.

 def reverse_string(input_string):     reversed_string = ""     for i in range(len(input_string) - 1, -1, -1):         reversed_string += input_string[i]     return reversed_string # Test the function my_string = "Hello, World!" reversed = reverse_string(my_string) print(reversed) #output !dlroW ,olleH

Urgent Search for Kidnapped Baby Girl in Walker County: Help Locate Harlow Darby Freeman

Image
In a distressing turn of events, law enforcement agencies have launched a search operation for a baby girl who was reportedly abducted in Walker County, Alabama. The Alabama Law Enforcement Agency promptly issued an Amber Alert at 9:40 p.m. to notify the public and seek their assistance in locating the missing child. The infant, identified as Harlow Darby Freeman, possesses distinctive features such as brown hair and blue eyes. She was last seen dressed in a tie-dye onesie and pink shorts. This blog post aims to provide an overview of the incident and encourage readers to remain vigilant while assisting the authorities. Incident Details: The incident unfolded at approximately 6:50 p.m. on Monday, at a residential property located on Crest Avenue in Parrish. Local law enforcement authorities were alerted to the kidnapping and have since mobilized their resources to address the situation swiftly. Although specific details surrounding the circumstances of the abduction remain undisclosed,