# you must get input in the specified order or else the words generated from the seed may be different # Never hardcode values as an answer; you will get the problem wrong if he tests different values # int() will not work on a list # strings in Python are immutable ( they cannot be changed ) # when typing in a weblink into the console, type a space after the link; sometimes remove the 's' in 'https' # Python indexing begins at 0 # '%' is the remainder operator # '==' tests (boolean) equality whereas '=' is assignment # accumulators must be initialized before loops # [] is subscripting into a sequence # import Math -> Math.pi # '+' implies concatenation with strings # you cannot "add" strings and numbers # you can modify a list but not a string # the len() will return an integer of the number of elements in a sequence # s.lower() -> lowercases all characters and s.Capitalize() -> capitalizes first letter # you can't use an operator in a print statement ( you actually can but not the " Prof. Cohoon way" ) # '//' means integer division # 5.0 // 2 = 2.0 ~tricky~ # to decode the content of a weblink use 'UTF-8' # url.get_text() hands back the contents of webpage and url.get_dataset() hands back the values of a dataset from the web # folders should end in a '/' # when you want to specify a range you must use the keyword range # Ex: for i in ( 0, n ): <- bad but legal in Python # first index in a list is 0 # '()' means a "tuple" or ordered pair (sequences); is like a list # end= will allow you to control the ending of the print statement # Escape sequences: '\t' = tab; '\n' = new line # accumulators that sums should start at 0; lists should be the empty brackets [], and strings '' # you can "remove" strings with replace() using the empty string '' as the replacement # ranges are exclusive for the second term; you must add one to get up to that value # string functions must be called on a individual string and not on an entire list -> use a loop!! # functions always have '()' Ex: 'reply.split' does not do what you want # compound statements have colons ':' while loops, for loops, if statements # min() and max() do not have to be used on sorted lists # sorted(): you give the function a list and the function returns a sorted version of the list; does not alter the original list list = [ 3, 1, 4 ] => [ 1, 3, 4 ] # for loops are used when you do not know how many times you will repeat some action; when you known the size you can iterate on the elements themselves # you cannot compare numbers to strings and vice-versa # strings are compared using lexicographical (dictionary) order # s.split() will hand back a list of strings; .split() is not a list function meaning you cannot split a list # range() is a built-in function that hands back a sequence of values that goes from the first element to the (last element - 1) # never write x = x.append( v ); never use assignment with the append() function on a list