# This is a comment ## This is also a comment ##### Still a comment # Commenting out code can be useful too ##while True: ## print "Don't do this" ''' This is a multi-line comment aka. docstring I can put several lines in here The comment doesn't end until I close the docstring ''' # Docstring for a function ''' adds each element in new_elements to my_list and returns the number of new elements added Inputs: my_list - the original list to add elements too new_elements - a list of new elements to add to my_list Effects: adds elements from new_elements to my_list Returns: the number of elements added to my_list ''' def append_and_count(my_list, new_elements): count = 0 for element in new_elements: my_list.append(element) count += 1 return count # Bad variable names def f(arg1, arg2, arg3): n = (-arg2 + (arg2**2 - 4*arg1*arg3)**(.5))/(2*arg1) m = (-arg2 - (arg2**2 - 4*arg1*arg3)**(.5))/(2*arg1) return n, m # Better names def quadratic_roots(a, b, c) root1 = (-b + (b**2 - 4*a*c)**(.5))/(2*a) root2 = (-b - (b**2 - 4*a*c)**(.5))/(2*a) return root1, root2