## Python program to find out the number of CPUs

Use the multiprocessing module of python to find the number of CPUs. cpu_count() is the function that returns the count of CPUs. Algorithm Start Import multiprocessing module Use the cpu_count() function provided in the multiprocessing module, it will return the number of CPU Display the count End Program Output CPUs Read more…

## Python program to determine if a Python shell is executing in 32bit or 64bit mode on OS

To determine the mode of python shell use struct module. The struct.calcsize(‘P’) calculates the number of bytes required to store a single pointer. It returns 4 for a 32-bit system and 8 for a 64-bit system Algorithm Start Import struct module Use the calcsize(āPā) function to get the number of Read more…

## Python program to check if a given string starts with a specified character using lambda expression

In this post, we will see how to check if a given string starts with the specified character or not using lambda expression along with startswith(). startswith() function is an inbuilt function used to check if the string starts with the specified character or not. Algorithm Step 1: Declare a Read more…

## Python program to find the square and cube of every number in the given list of numbers using lambda expression

In this post, we will see how to calculate the square and cube of every number of the given list of numbers. We will use map() along with lambda expression for calculation. Algorithm Step 1: Declare a list of numbers Step 2: Find the square of number by multiplying the Read more…

## Python program to sort a list of dictionaries using Lambda expression

In this post, we will see how to sort the list of dictionaries using lambda in python. lambda is a keyword in python which is used to define an anonymous function. Algorithm Step 1: Declare a list of employees. Step 2: Use the sorted() function and lambda expression to sort Read more…

## Python program to filter a list of numbers using Lambda expression

In this post, we will see how to filter the list of numbers. We will filter out the even and odd numbers from the list of numbers. To filter the numbers, we will use the filter() function available in python. Algorithm Step 1: Declare a list of numbers Step 2: Read more…

## Python program to extract the year, month, date using Lambda expression

In this post, we will see how to extract the year, month, and date from the provided date using a lambda expression. We will use datetime module to work with date objects. Algorithm Step 1: Import the datetime module Step 2: Use datetime.datetime(2021,10,17) function to take current date time as Read more…

## Python Program to Calculate the Length of a String Without Using an inbuilt Function

In this post, we will see how to Calculate the Length of a String Without Using an inbuilt Function. Algorithm Step 1: Declare a String and store it in a variable. Step 2: Declare a variable stringLength and initialize it to 0. Step 3: Use a for loop to iterate Read more…

## Python program to count repeated characters in a string and display the count of repeated characters

In this post, we will see how to count repeated characters in a string. Algorithm Step 1: Declare a String and store it in a variable. Step 2: Use 2 loops to find the duplicate characters. Outer loop will be used to select a character and initialize variable count to Read more…

## Python Program to count the occurrences of each word in a given string sentence

In this post, we will see how to count the occurrences of each word in a given string sentence. Algorithm Step 1: Declare a String and store it in a variable. Step 2: Declare a variable wordCount and initialise it to 0. Step 3: Split the string using split(ā ā) Read more…