Jump to content



Recommended Posts

Greetings Pythonistas

How do you guys go about with Vector types in python?

I understand VS had a native Vector type in python and multiplying/dividing? or adding/subtracting could be done directly in VS without external functions.

Am I right to assume that this is not the case for python? That adding/multiplying/etc two vectors would require a custom/external function?


v1 = (1, 4)
v2 = (4, 9)

#v1 * v2 would not work
#you'd need a custom function?

def vector_multiply(vec1, vec2):
   DP = (vec1[0]*vec2[0], vec1[1]*vec2[1])
   return DP

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...