Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

@ in python

# @ is used for matris multiplication
class Mat(list):
    def __matmul__(self, B):
        A = self
        return Mat([[sum(A[i][k]*B[k][j] for k in range(len(B)))
                    for j in range(len(B[0])) ] for i in range(len(A))])

A = Mat([[1,3],[7,5]])
B = Mat([[6,8],[4,2]])

print(A @ B)
Comment

python in

>>> "foo" in "foobar"
True
>>> "foo" in "Foobar"
False
>>> "foo" in "Foobar".lower()
True
>>> "foo".capitalize() in "Foobar"
True
>>> "foo" in ["bar", "foo", "foobar"]
True
>>> "foo" in ["fo", "o", "foobar"]
False
>>> ["foo" in a for a in ["fo", "o", "foobar"]]
[False, False, True]
Comment

@ in python

# @ is used for matris multiplication
class Mat(list):
    def __matmul__(self, B):
        A = self
        return Mat([[sum(A[i][k]*B[k][j] for k in range(len(B)))
                    for j in range(len(B[0])) ] for i in range(len(A))])

A = Mat([[1,3],[7,5]])
B = Mat([[6,8],[4,2]])

print(A @ B)
Comment

python in

>>> "foo" in "foobar"
True
>>> "foo" in "Foobar"
False
>>> "foo" in "Foobar".lower()
True
>>> "foo".capitalize() in "Foobar"
True
>>> "foo" in ["bar", "foo", "foobar"]
True
>>> "foo" in ["fo", "o", "foobar"]
False
>>> ["foo" in a for a in ["fo", "o", "foobar"]]
[False, False, True]
Comment

PREVIOUS NEXT
Code Example
Python :: windows task scheduler python script 
Python :: python merge list no duplicates 
Python :: how to remove outliers in dataset in python 
Python :: python describe 
Python :: how to find ascii value by python 
Python :: Multiple list comprehension 
Python :: run only few test cases in pytest 
Python :: pybase64 
Python :: python list clear vs del 
Python :: tuple vs set python 
Python :: how to convert a list to a string in python 
Python :: .extend python 
Python :: sum python 
Python :: if queryset is empty django 
Python :: oops python self and making an object of a class and calling function 
Python :: pycryptodome rsa encrypt 
Python :: logistic regression sklearn 
Python :: python add 
Python :: //= python meaning 
Python :: print column name and index dataframe python 
Python :: conda 
Python :: Adding column to CSV Dictreader 
Python :: python pprint on file 
Python :: django snippet 800 
Python :: sum of multiples of 5 from 1 to 100 
Python :: print(s[::-1]) 
Python :: how to get source code of website in python 
Python :: # str and int mixup in python: 
Python :: pandas add prefix to some range of columns 
Python :: pool.map multiple arguments 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =