0
What is the output of the code?
What is the output of this code? class Vec: def __init__(self,x,y): self.x=x self.y=y def add(self,other): return Vec(self.x+other.x,self.y+other.y) v1=Vec(3,4) v2=Vec(1,2) r=v1+v2 print(r.x+r.y)
4 Answers
+ 3
You need to specify what you didn't understand ,chapter was clear about it and you could always read comments to get a better understanding ,
+ 2
The best way to answer this is to have you create the code first and to ask more as to why this code has this type of result if you do not understand...
Plus I might point out that you have missing tags ... so as to help others who may be seeking help with the same question may find this difficult to find rather it be python functions, c++ functions and so on...
https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community
0
I tried but i can't understand . I written wrongly in my question



