I need to use recursion in order for the input to keep calling itself if the sum of the two inputs don't equal to 100, but every time I try, I keep ending up with it asking for the input once, and then once it has been entered, it returns a hexadecimal value.
class Z:
def __init__(self, probabilityX = 0, probabilityY = 0):
self.probabilityX = ""
self.probabilityY = ""
def getProbability(self):
print(self.probabilityX, self.probabilityY)
def input(self):
self.probabilityX = int(input("Enter probability of x:"))
self.probabilityY = int(input("Enter probability of y:"))
if self.probabilityX + self.probabilityY != 100:
input(self)
def main():
purs = Z()
purs.input()
purs.getProbability()
main()
Any help is greatly appreciated! Edit: Fixed typing errors