Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

* in python

>>> fruits = ['lemon', 'pear', 'watermelon', 'tomato']
>>> print(fruits[0], fruits[1], fruits[2], fruits[3])
lemon pear watermelon tomato
>>> print(*fruits)
lemon pear watermelon tomato
Comment

// in python

print(3 // 2)
# 1
print(3 / 2)
# 1.5
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 :: install python anaconda 
Python :: index in python 
Python :: python in line elif 
Python :: how to add new column in django 
Python :: merge sorting algorithm 
Python :: strip function in python 
Python :: how to slice list 
Python :: matplotlib units of scatter size 
Python :: KeyError 
Python :: python online 
Python :: how to write something in python 
Python :: bresenham circle drawing algorithm 
Python :: python incrémentation 
Python :: looping nested dictionaries 
Python :: python transpose 
Python :: firestore search query flutter 
Python :: Creating lambda expressions in comprehension list 
Python :: count function in python 
Python :: python iterrows 
Python :: python fetch 
Python :: List Join 2 Lists 
Python :: range(n,n) python 
Python :: get center position of countries geopandas 
Python :: icloud api python 
Python :: keras.utils.plot_model keeps telling me to install pydot and graphviz 
Python :: python - notification messages 
Python :: coreurls.py' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import. 
Python :: Factory reset the filesystem micropython 
Python :: python pytest use same tests for multiple modules 
Python :: refresh tab selenium python 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =