## Python Program to Find Frequency of Elements in a List

Program Code def frequency(list): unique_list = set(list) for item in unique_list: print(item, ":", list.count(item)) list = [1, 2, 3, 1, 2, 3, 2, 2, 4, 5, 5] frequency(list) Code Explanation We first create a set of the list. A set …

## Python Program to Find Fibonacci Series up to Nth Term

The Fibonacci series is a series of numbers in which each number is the sum of the two preceding numbers. The simplest form of the Fibonacci series is 0, 1, 1, 2, 3, 5, 8, 13, etc. The series was …

## Python Program to Find Hypotenuse

The hypotenuse is the longest side of a right triangle. It is also the side that is not opposite the right angle. If you’re trying to find the hypotenuse of a right-angled triangle, you can use the following equation: h …

## Python Program to Find Eigenvalues and Eigenvectors

Program Code import numpy as np A = np.array([[1,2,3],[4,5,6],[7,8,9]]) eigenvalues, eigenvectors = np.linalg.eig(A) print(f"The eigenvalues are {eigenvalues}") print(f"The eigenvectors are {eigenvectors}") Expected Output: The eigenvalues are [ 1.61168440e+01 -1.11684397e+00 -1.30367773e-15] The eigenvectors are [[-0.23197069 -0.78583024 0.40824829] [-0.52532209 -0.08675134 -0.81649658] [-0.8186735 …

## Python Program to Add Two Numbers

Program Code # take two inputs num1 = input('Enter first number: ') num2 = input('Enter second number: ') # add the inputs sum = float(num1) + float(num2) # display the sum print('The sum of {0} and {1} is {2}'.format(num1, num2, …

## Python Program to Find HCF and LCM of Two Numbers

Highest Common Factor (HCF) HCF is one of the most important concepts to understand. The HCF of two or more numbers is the largest number that divides evenly into all of the numbers. For example: The factors of 24 are …

## Python Program to Find Factorial of a Number Using Recursion

Factorials In math, the factorial of a number is the product of all the factorials of the number’s digits. For example, the factorial of 5 is 120. Recursion A recursive function is a function that calls itself. The most common …

## Python Program to Find Even or Odd

Even numbers are numbers that are evenly divided into two groups, such as 2, 4, 6, 8, 10. Odd numbers are numbers that are not evenly divided into two groups, such as 1, 3, 5, 7, 9. Program Code num …

## Python Program to Find Factorial of a Number Using FOR Loop

The factorial of a number is the product of all the positive integers less than or equal to the number. For example, the factorial of 5 is = 5 x 4 x 3 x 2 x 1 = 120. Program …

## Python Program to Find Frequency of Characters in a String

In Python, a string is a sequence of characters that you can use to store data. You can also create a string using the str() function, which takes an argument of type string. This function returns a string that contains …