mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-19 21:19:47 +00:00
Use ==/!= to compare str, bytes, and int literals (#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
This commit is contained in:
parent
a65efd42c4
commit
5b86928c4b
@ -16,7 +16,7 @@ install:
|
|||||||
- pip install flake8 # pytest # add another testing frameworks later
|
- pip install flake8 # pytest # add another testing frameworks later
|
||||||
before_script:
|
before_script:
|
||||||
# stop the build if there are Python syntax errors or undefined names
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
- flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
|
||||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
script:
|
script:
|
||||||
|
@ -22,7 +22,7 @@ for i in range(1, 1001):
|
|||||||
if i >= 100:
|
if i >= 100:
|
||||||
count += ones_counts[i/100] + 7 #add number of letters for "n hundred"
|
count += ones_counts[i/100] + 7 #add number of letters for "n hundred"
|
||||||
|
|
||||||
if i%100 is not 0:
|
if i%100 != 0:
|
||||||
count += 3 #add number of letters for "and" if number is not multiple of 100
|
count += 3 #add number of letters for "and" if number is not multiple of 100
|
||||||
|
|
||||||
if 0 < i%100 < 20:
|
if 0 < i%100 < 20:
|
||||||
@ -32,4 +32,4 @@ for i in range(1, 1001):
|
|||||||
else:
|
else:
|
||||||
count += ones_counts[i/1000] + 8
|
count += ones_counts[i/1000] + 8
|
||||||
|
|
||||||
print(count)
|
print(count)
|
||||||
|
@ -30,10 +30,10 @@ while year < 2001:
|
|||||||
day += 7
|
day += 7
|
||||||
|
|
||||||
if (year%4 == 0 and not year%100 == 0) or (year%400 == 0):
|
if (year%4 == 0 and not year%100 == 0) or (year%400 == 0):
|
||||||
if day > days_per_month[month-1] and month is not 2:
|
if day > days_per_month[month-1] and month != 2:
|
||||||
month += 1
|
month += 1
|
||||||
day = day-days_per_month[month-2]
|
day = day-days_per_month[month-2]
|
||||||
elif day > 29 and month is 2:
|
elif day > 29 and month == 2:
|
||||||
month += 1
|
month += 1
|
||||||
day = day-29
|
day = day-29
|
||||||
else:
|
else:
|
||||||
@ -45,7 +45,7 @@ while year < 2001:
|
|||||||
year += 1
|
year += 1
|
||||||
month = 1
|
month = 1
|
||||||
|
|
||||||
if year < 2001 and day is 1:
|
if year < 2001 and day == 1:
|
||||||
sundays += 1
|
sundays += 1
|
||||||
|
|
||||||
print(sundays)
|
print(sundays)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user