Answers for "python dot dot dot"

1

dot product python

A = [1,2,3,4,5,6]
B = [2,2,2,2,2,2]

# with numpy
import numpy as np
np.dot(A,B) # 42
np.sum(np.multiply(A,B)) # 42
#Python 3.5 has an explicit operator @ for the dot product
np.array(A)@np.array(B)# 42
# without numpy
sum([A[i]*B[i] for i in range(len(B))]) # 42
Posted by: Guest on April-17-2020
1

dot notation python

Almost everything in Python is an object. 
Every object has certain attributes and methods. 
The connection between the attributes or the methods with the object is 
indicated by a “dot” (”.”) written between them.
Posted by: Guest on August-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language