Most of this will come down to reading PEP8, however I'll state them here anyway.
if
statements don't need parentheses, so don't put them around them. You seem to go between doing this and not, remember to also be consistentif
statements don't need parentheses, so don't put them around them. You seem to go between doing this and not, remember to also be consistent- Functions at module level should have two new lines between them and other things, rather than one as you have now.
Functions at module level should have two new lines between them and other things, rather than one as you have now
- There should also be two blank lines between the
import
statements and other codeIn your function calls, you have unexpected spaces around keyword/parameter assignments
- In Whitespace in Expressions and Statements,
There should also be two blank lines between the
import
statements and other code You should have at least two spaces before inline comment.
Many of your lines are too long, they should only be 79 characters maximum
In Whitespace in Expressions and Statements,
Avoid extraneous whitespace in the following situations:
...
Immediately before a comma, semicolon, or colon:
Yes: if x == 4: print x, y; x, y = y, x No: if x == 4 : print x , y ; x , y = y , x
You shouldn't have multiple statements on one line (there should be a newline after the colon)
There is no newline at end of file as seen here.