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)

1st Dec 2019, 2:09 AM
Jegan Raj
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 ,
1st Dec 2019, 2:53 AM
Abhay
Abhay - avatar
+ 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
1st Dec 2019, 2:39 AM
BroFar
BroFar - avatar
0
I tried but i can't understand . I written wrongly in my question
1st Dec 2019, 2:50 AM
Jegan Raj