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:
@@ -64,15 +64,18 @@ class Problem4(Problem):
|
||||
#Stop the timer
|
||||
self.timer.stop()
|
||||
|
||||
#Save the results
|
||||
self.result = "The largest palindrome made from the product of two 3-digit numbers is " + str(self.palindromes[len(self.palindromes) - 1])
|
||||
|
||||
#Throw a flag to show the problem is solved
|
||||
self.solved = True
|
||||
#Reset the problem so it can be run again
|
||||
def reset(self):
|
||||
super().reset()
|
||||
self.palindromes.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 palindrome made from the product of two 3-digit numbers is " + str(self.palindromes[len(self.palindromes) - 1])
|
||||
#Gets
|
||||
#Returns the list of all palindromes
|
||||
def getPalindromes(self) -> list:
|
||||
|
||||
Reference in New Issue
Block a user