Skip to content

Commit e2dfae5

Browse files
authored
Avoid having SyntaxWarnings (#70)
Few quick fixes to avoid Python SyntaxWarnings in the output when running `./test.sh`.
1 parent 38e498e commit e2dfae5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Python/chapter01/p06_string_compression/nickolasteixeira.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def string_compression(string):
2727
new_str += '1'
2828

2929
for letter in new_str:
30-
if letter is '1':
30+
if letter == '1':
3131
new_count += 1
3232

33-
if len(string) // new_count is 1:
33+
if len(string) // new_count == 1:
3434
return string
3535
return new_str
3636

Python/chapter01/p07_rotate_matrix/nickolasteixeira.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def build_matrix(w, h, max=10):
1010

1111
def rotate_matrix(matrix):
1212
'''function that rotates a matrix clockwise'''
13-
if (len(matrix) is 0 or len(matrix) is not len(matrix[0])): return False
13+
if (len(matrix) == 0 or len(matrix) is not len(matrix[0])): return False
1414
matrix_length = len(matrix)
1515
for layer in range(matrix_length//2):
1616
first = layer

Python/chapter01/p08_zero_matrix/nickolasteixeira.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def zero_matrix(matrix):
1616

1717
for idx1 in range(len(matrix)):
1818
for idx2 in range(len(matrix[idx1])):
19-
if matrix[idx1][idx2] is 0:
19+
if matrix[idx1][idx2] == 0:
2020
zero_present = True
2121
row.append(idx1)
2222
column.append(idx2)

0 commit comments

Comments
 (0)