Error in my function
<p>When I run my code, I get this error:  </p>

<pre><code>&lt;function setDegreesAndMinutes at 0x10e7cf6e0&gt;
</code></pre>

<p>My code is:</p>

<pre><code>def setDegreesAndMinutes(self, degrees,minutes):

   self.degrees = int(input())

self.minutes = float(input())

 if(not(isinstance(degrees, int))):


raise ValueError("degrees shoule be int")

if(not(isinstance(minutes(int,float)))):

raise ValueError("minutes shoule be int or float")

 x = degrees 

 y = minutes

 return str(x)+'d'+str(y)

returnValue = setDegreesAndMinutes

print returnValue
</code></pre>

<p>it will be great, if anyone knows what happened!</p>

<p>That is not an error at all... You printed a <em>function object</em>. </p>

<p>You never <em>called</em> the function passing in <code>(self, degrees, minutes)</code> as parameters to <code>setDegreesAndMinutes</code>. </p>

<p>Also, typically <code>self</code> means you have defined that method in a class, so you need an instance of that class to even call <code>setDegreesAndMinutes</code>. In which case, you'd need <code>returnValue = some_class.setDegreesAndMinutes(degrees, minutes)</code></p>

<p>Then, do you really <em>need</em> parameters? You called <code>input</code>, which means you are prompting for values, therefore re-assigning the values that you otherwise would have passed into the method. If you do want to prompt for input from the method, then remove <code>degrees, minutes</code> from <code>(self, degrees, minutes)</code> and then you can do <code>returnValue = some_class.setDegreesAndMinutes()</code></p>

<p>And finally, setters aren't really necessary in Python, in my opinion. Plus, they usually don't return a value or prompt for input on their own. Make it simple - just <em>set</em> the value. </p>

<p>All in all, I think you are looking for something like this </p>

<pre><code>class Foo():
    def __init__(self, degrees, minutes):
        self.degrees = degrees
        self.minutes = minutes

degrees = int(input("degrees: "))

if not isinstance(degrees, int):
    raise ValueError("degrees should be int")

minutes = float(input("minutes: "))

if not isinstance(minutes, (int,float)): # I think you had extra parenthesis after minutes
    raise ValueError("minutes should be int or float")

f = Foo(degrees, minutes)
print(str(f.degrees) + 'd' + str(f.minutes))
</code></pre>

<p>And if you need to set the values, then do <code>f.degrees = X</code> for any <code>X</code> value, for example</p>

python function