Skip to content

Commit fedb3e7

Browse files
authored
Merge pull request TheAlgorithms#477 from ParthS007/patch1
Fixes#476 : Remove Multiple Unused Imports and Variable
2 parents 765a326 + 0856a61 commit fedb3e7

22 files changed

+34
-50
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __pycache__/
77
*.so
88

99
# Distribution / packaging
10+
.vscode/
1011
.Python
1112
env/
1213
build/

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

ArithmeticAnalysis/LUdecomposition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import math
21
import numpy
32

4-
def LUDecompose (table): #table that contains our data
3+
def LUDecompose (table):
4+
#table that contains our data
55
#table has to be a square array so we need to check first
66
rows,columns=numpy.shape(table)
77
L=numpy.zeros((rows,columns))
@@ -31,4 +31,4 @@ def LUDecompose (table): #table that contains our data
3131
matrix =numpy.array([[2,-2,1],[0,1,2],[5,3,1]])
3232
L,U = LUDecompose(matrix)
3333
print(L)
34-
print(U)
34+
print(U)

ArithmeticAnalysis/NewtonRaphsonMethod.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
from sympy import diff
55
from decimal import Decimal
6-
from math import sin, cos, exp
76

87
def NewtonRaphson(func, a):
98
''' Finds root from the point 'a' onwards by Newton-Raphson method '''
109
while True:
11-
x = a
1210
c = Decimal(a) - ( Decimal(eval(func)) / Decimal(eval(str(diff(func)))) )
1311

14-
x = c
1512
a = c
13+
1614
# This number dictates the accuracy of the answer
1715
if abs(eval(func)) < 10**-15:
1816
return c

Multi_Hueristic_Astar.py renamed to Graphs/Multi_Hueristic_Astar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import print_function
22
import heapq
33
import numpy as np
4-
import math
5-
import copy
64

75
try:
86
xrange # Python 2

Graphs/basic-graphs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def dijk(G, s):
140140

141141

142142
def topo(G, ind=None, Q=[1]):
143-
if ind == None:
143+
if ind is None:
144144
ind = [0] * (len(G) + 1) # SInce oth Index is ignored
145145
for u in G:
146146
for v in G[u]:

Project Euler/Problem 09/sol2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Given N, Check if there exists any Pythagorean triplet for which a+b+c=N
44
Find maximum possible value of product of a,b,c among all such Pythagorean triplets, If there is no such Pythagorean triplet print -1."""
55
#!/bin/python3
6-
import sys
76

87
product=-1
98
d=0

Project Euler/Problem 15/sol1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import print_function
2-
from math import factorial, ceil
2+
from math import factorial
33

44
def lattice_paths(n):
55
n = 2*n #middle entry of odd rows starting at row 3 is the solution for n = 1, 2, 3,...

ciphers/affine_cipher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def getRandomKey():
6868
while True:
6969
keyA = random.randint(2, len(SYMBOLS))
7070
keyB = random.randint(2, len(SYMBOLS))
71-
if cryptoMath.gcd(keyA, len(SYMBOLS)) == 1:
72-
return keyA * len(SYMBOLS) + keyB
71+
if cryptoMath.gcd(keyA, len(SYMBOLS)) == 1:
72+
return keyA * len(SYMBOLS) + keyB
7373

7474
if __name__ == '__main__':
7575
import doctest

data_structures/LinkedList/DoublyLinkedList.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def deleteHead(self):
2424
temp = self.head
2525
self.head = self.head.next # oldHead <--> 2ndElement(head)
2626
self.head.previous = None # oldHead --> 2ndElement(head) nothing pointing at it so the old head will be removed
27-
if(self.head == None):
27+
if(self.head is None):
2828
self.tail = None
2929
return temp
3030

@@ -58,7 +58,7 @@ def delete(self, x):
5858
current.next.previous = current.previous # 1 <--> 3
5959

6060
def isEmpty(self): #Will return True if the list is empty
61-
return(self.head == None)
61+
return(self.head is None)
6262

6363
def display(self): #Prints contents of the list
6464
current = self.head

0 commit comments

Comments
 (0)