Updated result to function

This commit is contained in:
2020-10-29 09:15:05 -04:00
parent 74b4233af0
commit ad458278d4
6 changed files with 32 additions and 25 deletions

View File

@@ -55,9 +55,6 @@ class Problem3(Problem):
#Stop the timer
self.timer.stop()
#Save the results
self.result = "The largest prime factor of " + str(self.__goalNumber) + " is " + str(self.factors[(len(self.factors) - 1)])
#Throw a flag to show the problem is solved
self.solved = True
@@ -65,7 +62,12 @@ class Problem3(Problem):
def reset(self):
super().reset()
self.factors.clear()
#Returns the result of solving the problem
def getResult(self):
#If the problem hasn't been solved throw an exception
if(not self.solved):
raise Unsolved("You must solve the problem before you can see the result")
return "The largest prime factor of " + str(self.__goalNumber) + " is " + str(self.factors[(len(self.factors) - 1)])
#Gets
#Returns the list of factors of the number
def getFactors(self) -> list: