Skip to content

Commit 5b86928

Browse files
cclausspoyea
authored andcommitted
Use ==/!= to compare str, bytes, and int literals (TheAlgorithms#767)
* Travis CI: Add more flake8 tests * Use ==/!= to compare str, bytes, and int literals ./project_euler/problem_17/sol1.py:25:7: F632 use ==/!= to compare str, bytes, and int literals if i%100 is not 0: ^ * Use ==/!= to compare str, bytes, and int literals * Update sol1.py
1 parent a65efd4 commit 5b86928

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ install:
1616
- pip install flake8 # pytest # add another testing frameworks later
1717
before_script:
1818
# stop the build if there are Python syntax errors or undefined names
19-
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
19+
- flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
2020
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
2121
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2222
script:

project_euler/problem_17/sol1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if i >= 100:
2323
count += ones_counts[i/100] + 7 #add number of letters for "n hundred"
2424

25-
if i%100 is not 0:
25+
if i%100 != 0:
2626
count += 3 #add number of letters for "and" if number is not multiple of 100
2727

2828
if 0 < i%100 < 20:
@@ -32,4 +32,4 @@
3232
else:
3333
count += ones_counts[i/1000] + 8
3434

35-
print(count)
35+
print(count)

project_euler/problem_19/sol1.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
day += 7
3131

3232
if (year%4 == 0 and not year%100 == 0) or (year%400 == 0):
33-
if day > days_per_month[month-1] and month is not 2:
33+
if day > days_per_month[month-1] and month != 2:
3434
month += 1
3535
day = day-days_per_month[month-2]
36-
elif day > 29 and month is 2:
36+
elif day > 29 and month == 2:
3737
month += 1
3838
day = day-29
3939
else:
@@ -45,7 +45,7 @@
4545
year += 1
4646
month = 1
4747

48-
if year < 2001 and day is 1:
48+
if year < 2001 and day == 1:
4949
sundays += 1
5050

51-
print(sundays)
51+
print(sundays)

0 commit comments

Comments
 (0)