We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
classPoints(object):def__init__(self,x,y,z):self.x=xself.y=yself.z=z# Vector subtractiondef__sub__(self,no):returnPoints(self.x-no.x,self.y-no.y,self.z-no.z)# Cross product with another vectordefcross(self,no):returnPoints(self.y*no.z-self.z*no.y,self.z*no.x-self.x*no.z,self.x*no.y-self.y*no.x)# Dot product with another vectordefdot(self,no):return((self.x*no.x)+(self.y*no.y)+(self.z*no.z))defabsolute(self):#Vectorabsolutelengthreturnpow((self.x**2+self.y**2+self.z**2),0.5)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Class 2 - Find the Torsional Angle
You are viewing a single comment's thread. Return to all comments →