unless you know what your text editor does with tabs otherwisewhat you see in your editor may not be what python sees when it counts tabs as number of spaces this is true in any block-structured languagenot just python--if the next programmer has tabs set differentlyit will be difficult or impossible to understand the structure of your code it' safer to use all tabs or all spaces for each block don' code in python reminder for / +programmersyou don' need to type parentheses around tests in if and while headers ( if ( == ):you canif you like (any expression can be enclosed in parentheses)but they are fully superfluous in this context alsodo not terminate all your statements with semicolonsit' technically legal to do this in python as wellbut it' totally useless unless you're placing more than one statement on single line (the end of line normally terminates statementand rememberdon' embed assignment statements in while loop testsand don' use {around blocks (indent your nested code blocks consistently insteaduse simple for loops instead of while or range another remindera simple for loop ( for in seq:is almost always simpler to code and often quicker to run than whileor range-based counter loop because python handles indexing internally for simple forit can sometimes be faster than the equivalent whilethough this can vary per code and python for code simplicity alonethoughavoid the temptation to count things in pythonbeware of mutables in assignments mentioned this in you need to be careful about using mutables in multiple-target assignment ( [])as well as in an augmented assignment ( +[ ]in both casesin-place changes may impact other variables see for details if you've forgotten why this is true don' expect results from functions that change objects in place we encountered this one earliertooin-place change operations like the list append and list sort methods introduced in do not return values (other than none)so you should call them without assigning the result it' not uncommon for beginners to say something like mylist mylist append(xto try to get the result of an appendbut what this actually does is assign mylist to nonenot to the modified list (in factyou'll lose your reference to the list altogethera more devious example of this pops up in python code when trying to step through dictionary items in sorted fashion it' fairly common to see code like for in keys(sort()this almost works--the keys method builds keys listand the sort method orders it--but because the sort method returns nonethe loop fails because it is ultimately loop over none ( nonsequencethis fails even sooner in python xbecause dictionary keys are viewsnot liststo code this correctlyeither use the newer sorted built-in functionwhich returns the sorted listor split the method calls out to statementsks list( keys())then ks sort()and finallyfor in ksthisby the wayis one case where you may the documentation interlude