## Adding and Subtracting Matrices in Python

```Suppose we have two matrices A and B.
A = [[1,2],[3,4]]
B = [[4,5],[6,7]]

then we get
A+B = [[5,7],[9,11]]
A-B = [[-3,-3],[-3,-3]]
```
[mai mult...]

## Categorize Password as Strong or Weak using Regex in Python

Given a password, we have to categorize it as a strong or weak one. There are some checks that need to be met to be a strong password. For a weak password, we need to return the reason for it to be weak.

Conditions to be fulfilled are:

• Minimum 9 characters and maximum 20 characters.
• Cannot be a newline or a space
• There should not be three or more repeating characters in a row.
• The same string pattern(minimum of two character length) should not be repeating.
[mai mult...]

## Python program to check the validity of a Password

In this program, we will be taking a password as a combination of alphanumeric characters along with special characters, and check whether the password is valid or not with the help of few conditions.

Primary conditions for password validation :

1. Minimum 8 characters.
2. The alphabets must be between [a-z]
3. At least one alphabet should be of Upper Case [A-Z]
4. At least 1 number or digit between [0-9].
5. At least 1 character from [ _ or @ or \$ ].
[mai mult...]

## How to multiply two matrices with python

How to create a program to multiply two matrices in python.
Examples:

```Input : X = [[1, 7, 3],
[3, 5, 6],
[6, 8, 9]]
Y = [[1, 1, 1, 2],
[6, 7, 3, 0],
[4, 5, 9, 1]]

Output : [55, 65, 49, 5]
[57, 68, 72, 12]
[90, 107, 111, 21]```
[mai mult...]

## How to find the size of a Tuple with Python

Tuple is a collection of Python objects much like a list. The sequence of values stored in a tuple can be of any type, and they are indexed by integers.

[mai mult...]

## How to break a list into chunks of N

Method1:Using Yield

The yield keyword enables a function to comeback where it left off when it is called again

[mai mult...]

## How to remove empty tuples from a list with python

We will see how can we remove an empty tuple from a given list of tuples.

[mai mult...]

## Check if all digits of a number divide it with Python3

Given a number n, find whether all digits of n divide it or not.

Examples:

```Input : 128
Output : Yes
128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.

Input : 130
Output : No

```

We want to test whether each digit is non-zero and divides the number. For example, with 128, we want to test d != 0 && 128 % d == 0 for d = 1, 2, 8. To do that, we need to iterate over each digit of the number.

[mai mult...]

## Python Script for Number of solutions to Modular Equations

Given A and B, the task is to find the number of possible values that X can take such that the given modular equation (A mod X) = B holds good. Here, X is also called a solution of the modular equation.

Examples:

```Input : A = 26, B = 2
Output : 6
Explanation
X can be equal to any of {3, 4, 6, 8,
12, 24} as A modulus any of these values
equals 2 i. e., (26 mod 3) = (26 mod 4)
= (26 mod 6) = (26 mod 8) =Output:2

Input : 21 5
Output : 2
Explanation
X can be equal to any of {8, 16} as A modulus
any of these values equals 5 i.e. (21 mod
8) = (21 mod 16) = 5```
[mai mult...]