First of all, my class is such a
In this class defines the attributes short, line 13 is a calculating formula of the distance, I tried, the dis variable is a number,
In the process of calculation, I have a step is:
S=s + li [p]. Every/li [p]. Short (t [I])
Every is a number of molecules, the question comes, if according to the above with the self to the dis. Dis assignment, the formula of the denominator can't calculate, display the following error, should be the denominator is not numeric types:
But I'm a piece of the attributes in the figure below added return dis, then can calculate the formula above,
If I don't return the dis, the following formula how to operate to reference this class - properties under calculate dis,
So I want to ask the main is that if this attribute (which is what I here short below) have multiple values dis1, dis2, dis3, calculate how individual calls outside the three dis value?
Big help thank you, I sprout new new to python
CodePudding user response:
My 'new, I wish who can speak some simple thank youCodePudding user response:
If it is in the class, with the self. Try disCodePudding user response:
This function has no return value because of you, so can't calculate, plus the return after the return values for numeric type, can be calculated, can put the dis class attributes to class attribute calls need not add return return valueCodePudding user response:
I in this class the following dis a value, then I return the dis li [p]. Short [I] (t) this value is the dis,But if I have dis1 middle class, dis2 dis3 three values, if return dis1, dis2, dis3, so I call how to separate one such as outside dis2?
CodePudding user response: