Removed unneccessary imports

This commit is contained in:
2020-10-29 09:02:36 -04:00
parent dfe5aa47f6
commit 74b4233af0
5 changed files with 13 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
#ProjectEuler/Python/Problem1.py #ProjectEuler/Python/Problem1.py
#Matthew Ellison #Matthew Ellison
# Created: 01-26-19 # Created: 01-26-19
#Modified: 10-26-20 #Modified: 10-29-20
#What is the sum of all the multiples of 3 or 5 that are less than 1000 #What is the sum of all the multiples of 3 or 5 that are less than 1000
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses #Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
""" """

View File

@@ -1,7 +1,7 @@
#ProjectEuler/Python/Problem2.py #ProjectEuler/Python/Problem2.py
#Matthew Ellison #Matthew Ellison
# Created: 01-26-19 # Created: 01-26-19
#Modified: 07-17-20 #Modified: 10-29-20
#The sum of the even Fibonacci numbers less than 4,000,000 #The sum of the even Fibonacci numbers less than 4,000,000
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses #Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
""" """
@@ -23,7 +23,6 @@
from Problems.Problem import Problem from Problems.Problem import Problem
from Stopwatch import Stopwatch
from Algorithms import getAllFib from Algorithms import getAllFib
from Unsolved import Unsolved from Unsolved import Unsolved
@@ -77,6 +76,7 @@ class Problem2(Problem):
raise Unsolved("You must solve the problem before can you see the sum") raise Unsolved("You must solve the problem before can you see the sum")
return self.fullSum return self.fullSum
#If you are running this file, automatically start the correct function #If you are running this file, automatically start the correct function
if __name__ == '__main__': if __name__ == '__main__':
problem = Problem2() #Call the function that answers the question problem = Problem2() #Call the function that answers the question

View File

@@ -1,7 +1,7 @@
#ProjectEuler/Python/Problem3.py #ProjectEuler/Python/Problem3.py
#Matthew Ellison #Matthew Ellison
# Created: 01-27-19 # Created: 01-27-19
#Modified: 07-17-20 #Modified: 10-29-20
#The largest prime factor of 600851475143 #The largest prime factor of 600851475143
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses #Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
""" """
@@ -23,7 +23,6 @@
from Problems.Problem import Problem from Problems.Problem import Problem
from Stopwatch import Stopwatch
from Algorithms import getFactors from Algorithms import getFactors
from Unsolved import Unsolved from Unsolved import Unsolved

View File

@@ -1,7 +1,7 @@
#ProjectEuler/Python/Problem4.py #ProjectEuler/Python/Problem4.py
#Matthew Ellison #Matthew Ellison
# Created: 01-28-19 # Created: 01-28-19
#Modified: 07-17-20 #Modified: 10-29-20
#Find the largest palindrome made from the product of two 3-digit numbers #Find the largest palindrome made from the product of two 3-digit numbers
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses #Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
""" """
@@ -23,7 +23,6 @@
from Problems.Problem import Problem from Problems.Problem import Problem
from Stopwatch import Stopwatch
from Unsolved import Unsolved from Unsolved import Unsolved
@@ -88,6 +87,7 @@ class Problem4(Problem):
raise Unsolved("You must solve the problem before you can get the largest palindrome") raise Unsolved("You must solve the problem before you can get the largest palindrome")
return self.palindromes[len(self.palindromes) - 1] return self.palindromes[len(self.palindromes) - 1]
#If you are running this file, automatically start the correct function #If you are running this file, automatically start the correct function
if __name__ == '__main__': if __name__ == '__main__':
problem = Problem4() problem = Problem4()

View File

@@ -1,7 +1,7 @@
#ProjectEulter/Python/Project5.py #ProjectEulter/Python/Project5.py
#Matthew Ellison #Matthew Ellison
# Created: 01-28-19 # Created: 01-28-19
#Modified: 07-17-20 #Modified: 10-29-20
#What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? #What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses #Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
""" """
@@ -23,14 +23,13 @@
from Problems.Problem import Problem from Problems.Problem import Problem
from Stopwatch import Stopwatch
from Unsolved import Unsolved from Unsolved import Unsolved
class Problem5(Problem): class Problem5(Problem):
#Variables #Variables
__startNum = 1 __startDivisor = 1
__stopNum = 20 __stopDivisor = 20
#Functions #Functions
#Constructor #Constructor
@@ -56,7 +55,7 @@ class Problem5(Problem):
#Set that it found the number to true, because it sets this flag when it doesn't find it #Set that it found the number to true, because it sets this flag when it doesn't find it
numFound = True numFound = True
#See if the current number is divisible by all numbers from 1 to 20 #See if the current number is divisible by all numbers from 1 to 20
for divisor in range(self.__startNum, self.__stopNum + 1): for divisor in range(self.__startDivisor, self.__stopDivisor + 1):
#If it is not set a flag to move to the next possible number #If it is not set a flag to move to the next possible number
if((currentNum % divisor) != 0): if((currentNum % divisor) != 0):
numFound = False numFound = False
@@ -66,6 +65,7 @@ class Problem5(Problem):
if(not numFound): if(not numFound):
currentNum += 2 currentNum += 2
#Set the smallest number to the number we just found
self.smallestNum = currentNum self.smallestNum = currentNum
#Stop the timer #Stop the timer
@@ -92,6 +92,7 @@ class Problem5(Problem):
raise Unsolved("You must solve the problem before you can get the requested number") raise Unsolved("You must solve the problem before you can get the requested number")
return self.smallestNum return self.smallestNum
#If it are running this file, automatically start the correct function #If it are running this file, automatically start the correct function
if __name__ == '__main__': if __name__ == '__main__':
problem = Problem5() problem = Problem5()
@@ -104,4 +105,4 @@ if __name__ == '__main__':
"""Results: """Results:
The smallest positive number that is evenly divisible by all numbers 1-20 is 232792560 The smallest positive number that is evenly divisible by all numbers 1-20 is 232792560
It took an average of 54.833 seconds to run this problem through 100 iterations It took an average of 54.833 seconds to run this problem through 100 iterations
""" """