mirror of
https://bitbucket.org/Mattrixwv/projecteulerpython.git
synced 2025-12-06 17:43:58 -05:00
Updated result to function
This commit is contained in:
@@ -56,13 +56,16 @@ class Problem1(Problem):
|
||||
#Throw a flag to show the problem is solved
|
||||
self.solved = True
|
||||
|
||||
#Save the results
|
||||
self.result = "The sum of all numbers < " + str(self.__topNum + 1) + " is " + str(self.fullSum)
|
||||
|
||||
#Reset the problem so it can be run again
|
||||
def reset(self):
|
||||
super().reset()
|
||||
self.fullSum = 0
|
||||
#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 sum of all numbers < " + str(self.__topNum + 1) + " is " + str(self.fullSum)
|
||||
#Gets
|
||||
#Returns the requested sum
|
||||
def getSum(self) -> int:
|
||||
|
||||
Reference in New Issue
Block a user