I have a class and two methods. One method gets input from the user and stores it in two variables, x and y. I want another method that accepts an input so adds that input to x and y. When I run calculate(z) for some number z, it gives me errors saying the global variables x and y aren't defined. Obviously this means that the calculate method isn't getting access to x and y from getinput(). What am I doing wrong?
class simpleclass (object):
def getinput (self):
x = input("input value for x: ")
y = input("input value for y: ")
def calculate (self, z):
print x+y+z