Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class for Vector
#1
Hello! Angel
I am new in programming in python. I got a homework to create class MyVector,
- constructor will accept (to self) one parameter (it will be one-dimensional array)
- method get_vector(self) return one-dimensional array containing the vector elements
- with special method __mul__(self,other) implement the dot product of two objects MyVector (the output is a scalar, so one number)
btw I cant import other modules.

I have this:
[Image: ZvD49DyKCd.jpg]

In my mind, get_vector(self) is right. But __mul__(self,other) is not working properly. Do you know how to make things right? Blush
Reply


Messages In This Thread
Class for Vector - by no_named_nobody - Oct-06-2019, 02:16 PM
RE: Class for Vector - by buran - Oct-06-2019, 02:44 PM
RE: Class for Vector - by no_named_nobody - Oct-06-2019, 02:50 PM
RE: Class for Vector - by buran - Oct-06-2019, 02:57 PM
RE: Class for Vector - by no_named_nobody - Oct-06-2019, 03:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  vector field plots Larssauerkraut 0 1,501 Oct-15-2019, 11:15 AM
Last Post: Larssauerkraut
  Divide a vector Langosmon 1 2,665 May-13-2018, 09:09 AM
Last Post: ThiefOfTime
  Classification by support vector method qwerty 1 2,922 Apr-16-2017, 07:16 PM
Last Post: sparkz_alot
  vector sum of tuples roadrage 7 7,600 Nov-28-2016, 09:54 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020