Prev | Contents | Next

  1. https://docs.python.org/3/↩︎

  2. http://www.catb.org/~esr/faqs/smart-questions.html↩︎

  3. https://www.youtube.com/watch?v=ry55–J4_VQ↩︎

  4. https://www.python.org/downloads/↩︎

  5. https://www.python.org/downloads/↩︎

  6. https://beej.us/guide/bgpython/source/examples/hello.py↩︎

  7. https://en.wikiquote.org/wiki/Edsger_W._Dijkstra↩︎

  8. https://beej.us/guide/bgpython/source/examples/vartest.py↩︎

  9. More generally speaking, variables refer to objects, but since all we have for now is numeric values, let’s just go with values.↩︎

  10. Later we’ll learn that other types of buckets can hold more than one thing.↩︎

  11. https://en.wikipedia.org/wiki/Form_1040↩︎

  12. Integer division truncates the part of the number after the decimal point.↩︎

  13. https://en.wikipedia.org/wiki/Order_of_operations↩︎

  14. We call shorthand like this syntactic sugar because it makes things that much sweeter for the developers.↩︎

  15. input() is what we call a built-in in Python. It comes with the language and we get to make use of it. Later we’ll learn to write our own functions from scratch!↩︎

  16. https://beej.us/guide/bgpython/source/examples/inputtest.py↩︎

  17. This is the way most computers represent numbers with a decimal point in them, such as \(3.14159265358979\). When you see “floating point” or “float”, think “number with a decimal point in it” as opposed to “integer”.↩︎

  18. https://beej.us/guide/bgpython/source/examples/twosum.py↩︎

  19. https://beej.us/guide/bgpython/source/examples/ex_twosumfloat.py↩︎

  20. https://beej.us/guide/bgpython/source/examples/ex_twosumdiff.py↩︎

  21. https://beej.us/guide/bgpython/source/examples/ex_threesumdiff.py↩︎

  22. https://beej.us/guide/bgpython/source/examples/ex_xsquared.py↩︎

  23. https://en.wikipedia.org/wiki/Quadratic_formula↩︎

  24. https://beej.us/guide/bgpython/source/examples/ex_quadratic.py↩︎

  25. https://en.wikipedia.org/wiki/Scientific_notation↩︎

  26. https://beej.us/guide/bgpython/source/examples/ex_quadratic2.py↩︎

  27. https://en.wikipedia.org/wiki/George_Boole↩︎

  28. Ooooo! 1s and 0s! Binary! For just a moment, here, we’re getting a glimpse of the deep workings of the machine.↩︎

  29. https://beej.us/guide/bgpython/source/examples/booltest.py↩︎

  30. https://beej.us/guide/bgpython/source/examples/ifelse1.py↩︎

  31. https://beej.us/guide/bgpython/source/examples/while.py↩︎

  32. We could have also tested i <= 29.↩︎

  33. Have two loops!↩︎

  34. https://beej.us/guide/bgpython/source/examples/hashast.py↩︎

  35. https://beej.us/guide/bgpython/source/examples/ex_10ksum.py↩︎

  36. https://beej.us/guide/bgpython/source/examples/ex_xfourth.py↩︎

  37. https://beej.us/guide/bgpython/source/examples/ex_ntimes10.py↩︎

  38. https://beej.us/guide/bgpython/source/examples/ex_oddsbetween.py↩︎

  39. A number x is divisible by 3 if x % 3 == 0.↩︎

  40. This is a famous interview problem for junior devs.↩︎

  41. https://beej.us/guide/bgpython/source/examples/ex_fizzbuzz.py↩︎

  42. https://en.wikipedia.org/wiki/Turing_completeness↩︎

  43. We’ll talk about regular expressions, or regexes, later.↩︎

  44. More on lists in upcoming chapters.↩︎

  45. Spaces, tabs, and newlines.↩︎

  46. https://docs.python.org/3/library/stdtypes.html#string-methods↩︎

  47. Also called squirrely braces.↩︎

  48. https://beej.us/guide/bgpython/source/examples/multtable.py↩︎

  49. https://beej.us/guide/bgpython/source/examples/ex_fstring.py↩︎

  50. https://beej.us/guide/bgpython/source/examples/ex_goatcount.py↩︎

  51. https://beej.us/guide/bgpython/source/examples/ex_uppervowel.py↩︎

  52. https://beej.us/guide/bgpython/source/examples/ex_charat.py↩︎

  53. https://beej.us/guide/bgpython/source/examples/ex_sliceat.py↩︎

  54. Technically, lists and dictionaries are objects, so we’re being a bit redundant.↩︎

  55. Technically we can use it to iterate over anything that’s iterable, which is quite a number of things.↩︎

  56. Idiomatic means “the standard, accepted way of doing a thing in a language”.↩︎

  57. https://beej.us/guide/bgpython/source/examples/listdouble.py↩︎

  58. Remember that a method is a function that you call on a particular object with the dot (.) operator.↩︎

  59. https://beej.us/guide/bgpython/source/examples/listops.py↩︎

  60. https://beej.us/guide/bgpython/source/examples/fiblist.py↩︎

  61. We’re using a technique here generally called bottom-up dynamic programming. But that’s a story for another time. Probably involving Fibonacci again.↩︎

  62. Names can be made up of letters, digits, and underscores, as long as they don’t start with a digit.↩︎

  63. https://en.wikipedia.org/wiki/Roguelike↩︎

  64. Well, not at this point in our learning, anyway.↩︎

  65. https://en.wikipedia.org/wiki/ANSI_escape_code↩︎

  66. https://www.youtube.com/watch?v=q3fx6TugN7g↩︎

  67. https://docs.python.org/3/howto/curses.html↩︎

  68. https://beej.us/guide/bgpython/source/examples/adv1.py↩︎

  69. https://beej.us/guide/bgpython/source/examples/ex_refval.py↩︎

  70. https://beej.us/guide/bgpython/source/examples/ex_listsum.py↩︎

  71. https://beej.us/guide/bgpython/source/examples/ex_listchange.py↩︎

  72. https://beej.us/guide/bgpython/source/examples/ex_replist.py↩︎

  73. https://beej.us/guide/bgpython/source/examples/ex_listcompx5.py↩︎

  74. https://beej.us/guide/bgpython/source/examples/ex_listcompcap.py↩︎

  75. https://beej.us/guide/bgpython/source/examples/ex_listmult.py↩︎

  76. This is all about family trees. Did you know I’m related to Queen Elizabeth II (by marriage)? I’m her mother’s sister’s husband’s father’s father’s sister’s daughter’s husband’s wife’s (drama!) sister’s husband’s father’s brother’s son’s son’s daughter’s son’s daughter’s son. For realsies! I’m willing to bet that you’re related to Queen Elizabeth II, as well. That makes us cousins!↩︎

  77. Except via Queen Elizabeth II, like the rest of us.↩︎

  78. https://en.wikipedia.org/wiki/JSON↩︎

  79. Time complexity enthusiasts will recognize this as \(O(1)\), or constant time.↩︎

  80. If you haven’t seen it before or need a refresher, this is a value that represents “no value”. It’s a placeholder (what we call a sentinel value) to indicate a no-value condition.↩︎

  81. Or what we call lexicographically sorted. It’s like alphabetical, but on steroids so that it can handle letters, numbers, punctuation and so on, all of which are all numbers deep down.↩︎

  82. That’s Noughts and Crosses, to some of you.↩︎

  83. It’s not unusual.↩︎

  84. https://en.wikipedia.org/wiki/Universally_unique_identifier↩︎

  85. https://beej.us/guide/bgpython/source/examples/familytree.py↩︎

  86. https://beej.us/guide/bgpython/source/examples/ex_printkeys.py↩︎

  87. https://beej.us/guide/bgpython/source/examples/ex_printkeysvals.py↩︎

  88. https://beej.us/guide/bgpython/source/examples/ex_list2dict.py↩︎

  89. https://beej.us/guide/bgpython/source/examples/ex_list2dictsort.py↩︎

  90. https://en.wikipedia.org/wiki/Pythagorean_theorem#Euclidean_distance↩︎

  91. Purists will point out exceptions to this, like with __add__(), but let’s skip that for now.↩︎

  92. https://en.wikipedia.org/wiki/Don%27t_repeat_yourself↩︎

  93. https://docs.python.org/3/library/functions.html↩︎

  94. https://www.defcon.org/html/defcon-2/defcon-2.html↩︎

  95. This happens all the time in development.↩︎

  96. https://en.wikipedia.org/wiki/Evaluation_strategy↩︎

  97. https://en.wikipedia.org/wiki/C_(programming_language)↩︎

  98. https://en.wikipedia.org/wiki/Fortran↩︎

  99. https://en.wikipedia.org/wiki/C%2B%2B↩︎

  100. https://beej.us/guide/bgpython/source/examples/shipdist.py↩︎

  101. https://beej.us/guide/bgpython/source/examples/ex_max.py↩︎

  102. https://beej.us/guide/bgpython/source/examples/ex_ennum.py↩︎

  103. https://beej.us/guide/bgpython/source/examples/ex_grav.py↩︎

  104. This technique is called parallel arrays or, in the case of Python, parallel lists. It’s not a popular technique today, having been made obsolete by the very thing we’re talking about in this chapter.↩︎

  105. https://en.wikipedia.org/wiki/Camel_case↩︎

  106. In fact, I think the choice to use all those underscores in __init__() is one of the few bad design choices in the language.↩︎

  107. A lot of other languages use the variable name this instead of self.↩︎

  108. Technically, even the methods are attributes, but we’ll get into the pedantic details another time.↩︎

  109. https://beej.us/guide/bgpython/source/examples/moviesign.py↩︎

  110. https://beej.us/guide/bgpython/source/examples/moviesign2.py↩︎

  111. https://docs.python.org/3/library/datetime.html↩︎

  112. https://beej.us/guide/bgpython/source/examples/ex_car.py↩︎

  113. https://beej.us/guide/bgpython/source/examples/ex_subway.py↩︎

  114. https://beej.us/guide/bgpython/source/examples/ex_adv2.py↩︎

  115. https://beej.us/guide/bgpython/source/examples/example.zip↩︎

  116. https://docs.python.org/3/library/index.html↩︎

  117. https://pypi.org/↩︎

  118. https://docs.python.org/3/library/sys.html↩︎

  119. https://docs.python.org/3/library/calendar.html↩︎

  120. https://docs.python.org/3/library/index.html↩︎

  121. https://en.wikipedia.org/wiki/Comma-separated_values↩︎

  122. https://docs.python.org/3/library/zipfile.html↩︎

  123. https://en.wikipedia.org/wiki/Cyclic_redundancy_check↩︎

  124. https://beej.us/guide/bgpython/source/examples/zipdir.py↩︎

  125. https://beej.us/guide/bgpython/source/examples/example.zip↩︎

  126. https://docs.python.org/3/library/os.html↩︎

  127. https://beej.us/guide/bgpython/source/examples/ex_printpid.py↩︎

  128. https://docs.python.org/3/library/uuid.html↩︎

  129. https://beej.us/guide/bgpython/source/examples/ex_uuidgen.py↩︎

  130. https://docs.python.org/3/library/textwrap.html#textwrap.TextWrapper↩︎

  131. https://beej.us/guide/bgpython/source/examples/ex_wrap.py↩︎

  132. https://docs.python.org/3/library/random.html↩︎

  133. https://beej.us/guide/bgpython/source/examples/ex_rand1000.py↩︎

  134. https://docs.python.org/3/library/time.html↩︎

  135. https://beej.us/guide/bgpython/source/examples/ex_curdate.py↩︎

  136. https://beej.us/guide/bgpython/source/examples/ex_zipextract.py↩︎

  137. The Operating System is like Linux, Windows, MacOS, Unix, etc. It’s a program that helps you, the user, interface with the hardware on the system, like keyboards, screens, and disks.↩︎

  138. It’s a level of polish that other devs will expect. If they see you’re not thorough enough to close any files you open, they’ll wonder what else you’ve missed.↩︎

  139. https://beej.us/guide/bgpython/source/examples/fileread1.py↩︎

  140. Meaning, the One Right-ish Way to do something.↩︎

  141. https://beej.us/guide/bgpython/source/examples/lines.txt↩︎

  142. A function stub is a callable function that takes all the same arguments and, if necessary, returns a sensible value. But it doesn’t, in fact, do anything of use. It’s a good way to test that your overall call flow is working right. And it gives you a nice, easy TODO spot to fill out.↩︎

  143. https://en.wikipedia.org/wiki/Off-by-one_error↩︎

  144. https://beej.us/guide/bgpython/source/examples/lineedit.py↩︎

  145. True story. This was back when I was in the 7th grade and computers were a bit of a novelty. We had a daisywheel printer at home which was fairly indistinguishable from a typewriter. In real life, though, I didn’t write a program to generate the lines. I told dad about the task, and he rolled his eyes and showed me how to copy and paste in WordStar.↩︎

  146. https://beej.us/guide/bgpython/source/examples/ex_writelines.py↩︎

  147. https://beej.us/guide/bgpython/source/examples/games.csv↩︎

  148. https://en.wikipedia.org/wiki/M.U.L.E.↩︎

  149. https://beej.us/guide/bgpython/source/examples/ex_simplecsv.py↩︎

  150. https://beej.us/guide/bgpython/source/examples/ex_multtablefile.py↩︎

  151. https://docs.python.org/3/library/stdtypes.html#str.split↩︎

  152. https://beej.us/guide/bgpython/source/examples/wargames.txt↩︎

  153. https://beej.us/guide/bgpython/source/examples/ex_wc.py↩︎

  154. https://beej.us/guide/bgpython/source/examples/ex_sort.py↩︎

  155. https://docs.python.org/3/library/exceptions.html↩︎

  156. https://docs.python.org/3/library/exceptions.html↩︎

  157. A traceback, also known as a stack trace, is a list of all the function calls that have taken place to get to this point. It’s really useful information for debugging.↩︎

  158. https://docs.python.org/3/library/exceptions.html↩︎

  159. https://docs.python.org/3/library/exceptions.html↩︎

  160. https://beej.us/guide/bgpython/source/examples/head.py↩︎

  161. https://beej.us/guide/bgpython/source/examples/ex_catchorder.py↩︎

  162. https://beej.us/guide/bgpython/source/examples/ex_listadd2.py↩︎

  163. https://beej.us/guide/bgpython/source/examples/ex_listadd.py↩︎

  164. https://www.youtube.com/watch?v=XO0pcWxcROI↩︎

  165. Apart from the lazy factor, that is.↩︎

  166. https://en.wikipedia.org/wiki/Imaginary_number↩︎

  167. https://en.wikipedia.org/wiki/Natural_logarithm↩︎

  168. https://en.wikipedia.org/wiki/Big_O_notation↩︎

  169. https://docs.python.org/3/tutorial/floatingpoint.html#tut-fp-issues↩︎

  170. Which should serve as a not-so-gentle reminder that you should document your code.↩︎

  171. https://en.wikipedia.org/wiki/End-of-file↩︎

  172. This is a bit of a pun around the original Bourne Shell from back in the day. Bash improves on it a bit.↩︎

  173. https://git-scm.com/↩︎

  174. https://git-scm.com/downloads↩︎

  175. https://learn.microsoft.com/en-us/windows/wsl/install↩︎

  176. https://code.visualstudio.com/↩︎

  177. https://beej.us/guide/bgpython/source/examples/hello.py↩︎

  178. https://en.wikiquote.org/wiki/Edsger_W._Dijkstra↩︎


Prev | Contents | Next