Added the first slide
authorNeil Smith <neil.git@njae.me.uk>
Fri, 7 Mar 2014 20:08:20 +0000 (15:08 -0500)
committerNeil Smith <neil.git@njae.me.uk>
Fri, 7 Mar 2014 20:08:20 +0000 (15:08 -0500)
slides/caesar-encipher.html [new file with mode: 0644]

diff --git a/slides/caesar-encipher.html b/slides/caesar-encipher.html
new file mode 100644 (file)
index 0000000..4f99cc2
--- /dev/null
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Title</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+    <style type="text/css">
+      /* Slideshow styles */
+    </style>
+  </head>
+  <body>
+    <textarea id="source">
+
+class: center, middle
+
+# Caesar ciphers
+
+* Letter-by-letter enciphering
+
+---
+
+# The [string module](http://docs.python.org/3.3/library/string.html) is your friend
+
+```python
+import string
+string.ascii_letters
+string.ascii_lowercase
+string.ascii_uppercase
+string.digits
+string.punctuation
+```
+
+---
+
+# Doctest
+
+* Why document?
+* Why test?
+
+---
+
+# The magic doctest incantation
+
+```python
+if __name__ == "__main__":
+    import doctest
+    doctest.testmod()
+```
+
+---
+
+# Doing all the letters
+
+## Abysmal
+
+```python
+ciphertext = ''
+for i in range(len(plaintext)):
+    ciphertext += caesar_encipher_letter(plaintext[i], key)
+```
+
+---
+
+# Doing all the letters
+
+## (Merely) Bad
+
+```python
+ciphertext = ''
+for p in plaintext:
+    ciphertext += caesar_encipher_letter(p, key)
+```
+
+---
+
+# Doing all the letters
+
+## Good (but unPythonic)
+
+```python
+ciphertext = map(lambda p: caesar_encipher_letter(p, key), plaintext)
+```
+
+---
+
+# Doing all the letters
+
+## Best
+
+```python
+ciphertext = [caesar_encipher_letter(p, key) for p in plaintext]
+```
+
+
+    </textarea>
+    <script src="http://gnab.github.io/remark/downloads/remark-0.6.0.min.js" type="text/javascript">
+    </script>
+    <script type="text/javascript">
+      var slideshow = remark.create();
+    </script>
+  </body>
+</html>
\ No newline at end of file