Update Menu.ipynb

This commit is contained in:
Peter Norvig 2022-10-21 18:20:36 -07:00 committed by GitHub
parent e4e41fd14f
commit 1af2b6db4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@
" \"\"\"All sensible key sequences, in shortest-first order.\n", " \"\"\"All sensible key sequences, in shortest-first order.\n",
" (For ties, use fewer arrows first; if still tied, use alphabetical ordering.)\"\"\"\n", " (For ties, use fewer arrows first; if still tied, use alphabetical ordering.)\"\"\"\n",
" longest = max(map(len, items))\n", " longest = max(map(len, items))\n",
" for n in range(longest + 2): # `n` is total length of key sequence; shortest first\n", " for n in range(longest + 1): # `n` is total length of key sequence; shortest first\n",
" for a in range(n + 1): # `a` is number of arrows in key sequence; fewer first\n", " for a in range(n + 1): # `a` is number of arrows in key sequence; fewer first\n",
" keyseqs = {item[:n - a] + a * arrow \n", " keyseqs = {item[:n - a] + a * arrow \n",
" for item in items for arrow in (up, down)}\n", " for item in items for arrow in (up, down)}\n",