From 1b090a6aab7c386dde2ec996dc844ec4c08e9d56 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 14:54:28 -0800 Subject: [PATCH 01/63] Add my stuff from Chapter 0 --- 01_hello/hello.py | 5 +++++ README_fleide.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 01_hello/hello.py create mode 100644 README_fleide.md diff --git a/01_hello/hello.py b/01_hello/hello.py new file mode 100644 index 000000000..bab4aea59 --- /dev/null +++ b/01_hello/hello.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +# Gets python3 from env rather than current session + +# Purpose: Say Hello +print('Hello, World!') \ No newline at end of file diff --git a/README_fleide.md b/README_fleide.md new file mode 100644 index 000000000..42e35a986 --- /dev/null +++ b/README_fleide.md @@ -0,0 +1,47 @@ +# Tiny Python Projects + +## Chapter 0 - Installation + +First pip was missing so: + +```BASH +curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + +python3 get-pip.py +python3 -m pip install -U pip +``` + +Got an error message : ` The scripts pip, pip3 and pip3.8 are installed in '/home/fleide/.local/bin' which is not on PATH` +Which means I need to add that directory to the `PYTHONPATH`. +On Ubuntu (WSL), that's in `~/.bashrc` where you add `export PYTHONPATH="${PYTHONPATH}:/my/other/path"` + +Then after forking the repo: + +```BASH +git clone https://github.com/Fleid/tiny_python_projects +cd tiny_python_projects +python3 -m pip install -r requirements.txt +``` +The requirements installed: +- Code formatters : black, yapf +- Linters : Pylint, flake8 +- Type hints : Mypy +- Interactive (notebook) Python : ipython + +### NB + +```BASH +yapf -i hello.py +bin/new.py HelloWorld.py +``` + +## Chapter 1 - Write and test a Python program + +```BASH +pytest -v test.py +``` + +Add a shush bang (#!) to get the file executable from the shell +Use `which python3` to find which one to link to, then add `#!/usr/bin/python3` to the file +Or default to the env via `#!/usr/bin/env python3` to make it portable +Then run with `./hello.py` (if necessary `chmod +x hello.py`) \ No newline at end of file From 96c19150e3e375538965bb91430cb2ef9d131cbc Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 15:34:21 -0800 Subject: [PATCH 02/63] Move stuff around --- {02_crowsnest => 00_TODO/02_crowsnest}/Makefile | 0 {02_crowsnest => 00_TODO/02_crowsnest}/README.md | 0 {02_crowsnest => 00_TODO/02_crowsnest}/all_test.sh | 0 {02_crowsnest => 00_TODO/02_crowsnest}/solution.py | 0 {02_crowsnest => 00_TODO/02_crowsnest}/test.py | 0 {03_picnic => 00_TODO/03_picnic}/Makefile | 0 {03_picnic => 00_TODO/03_picnic}/README.md | 0 {03_picnic => 00_TODO/03_picnic}/all_test.sh | 0 {03_picnic => 00_TODO/03_picnic}/solution.py | 0 {03_picnic => 00_TODO/03_picnic}/test.py | 0 .../04_jump_the_five}/Makefile | 0 .../04_jump_the_five}/README.md | 0 .../04_jump_the_five}/all_test.sh | 0 .../04_jump_the_five}/solution1.py | 0 .../04_jump_the_five}/solution2.py | 0 .../04_jump_the_five}/solution3.py | 0 .../04_jump_the_five}/solution4.py | 0 .../04_jump_the_five}/solution5.py | 0 .../04_jump_the_five}/test.py | 0 {05_howler => 00_TODO/05_howler}/.gitignore | 0 {05_howler => 00_TODO/05_howler}/Makefile | 0 {05_howler => 00_TODO/05_howler}/README.md | 0 {05_howler => 00_TODO/05_howler}/all_test.sh | 0 {05_howler => 00_TODO/05_howler}/mk-test-out.sh | 0 {05_howler => 00_TODO/05_howler}/solution1.py | 0 {05_howler => 00_TODO/05_howler}/solution2.py | 0 .../05_howler}/test-outs/preamble.txt | 0 .../05_howler}/test-outs/sonnet-29.txt | 0 .../05_howler}/test-outs/the-bustle.txt | 0 {05_howler => 00_TODO/05_howler}/test.py | 0 {06_wc => 00_TODO/06_wc}/Makefile | 0 {06_wc => 00_TODO/06_wc}/README.md | 0 {06_wc => 00_TODO/06_wc}/all_test.sh | 0 {06_wc => 00_TODO/06_wc}/inputs/empty.txt | 0 {06_wc => 00_TODO/06_wc}/inputs/foo.txt | 0 {06_wc => 00_TODO/06_wc}/inputs/one.txt | 0 {06_wc => 00_TODO/06_wc}/inputs/two.txt | 0 {06_wc => 00_TODO/06_wc}/solution.py | 0 {06_wc => 00_TODO/06_wc}/test.py | 0 {07_gashlycrumb => 00_TODO/07_gashlycrumb}/Makefile | 0 .../07_gashlycrumb}/README.md | 0 .../07_gashlycrumb}/all_test.sh | 0 .../07_gashlycrumb}/alternate.txt | 0 .../07_gashlycrumb}/gashlycrumb.txt | 0 .../07_gashlycrumb}/gashlycrumb_interactive.py | 0 .../07_gashlycrumb}/solution1.py | 0 .../07_gashlycrumb}/solution2_dict_comp.py | 0 .../07_gashlycrumb}/solution3_dict_get.py | 0 {07_gashlycrumb => 00_TODO/07_gashlycrumb}/test.py | 0 .../08_apples_and_bananas}/Makefile | 0 .../08_apples_and_bananas}/README.md | 0 .../08_apples_and_bananas}/all_test.sh | 0 .../solution1_iterate_chars.py | 0 .../08_apples_and_bananas}/solution2_str_replace.py | 0 .../solution3_str_translate.py | 0 .../solution4_list_comprehension.py | 0 .../solution5.1_no_closure.py | 0 .../solution5_list_comp_function.py | 0 .../08_apples_and_bananas}/solution6_map_lambda.py | 0 .../solution7_map_function.py | 0 .../08_apples_and_bananas}/solution8_regex.py | 0 .../08_apples_and_bananas}/test.py | 0 {09_abuse => 00_TODO/09_abuse}/Makefile | 0 {09_abuse => 00_TODO/09_abuse}/README.md | 0 {09_abuse => 00_TODO/09_abuse}/all_test.sh | 0 {09_abuse => 00_TODO/09_abuse}/solution.py | 0 {09_abuse => 00_TODO/09_abuse}/test.py | 0 {10_telephone => 00_TODO/10_telephone}/Makefile | 0 {10_telephone => 00_TODO/10_telephone}/README.md | 0 {10_telephone => 00_TODO/10_telephone}/all_test.sh | 0 {10_telephone => 00_TODO/10_telephone}/solution1.py | 0 .../10_telephone}/solution2_list.py | 0 {10_telephone => 00_TODO/10_telephone}/test.py | 0 .../11_bottles_of_beer}/Makefile | 0 .../11_bottles_of_beer}/README.md | 0 .../11_bottles_of_beer}/all_test.sh | 0 .../11_bottles_of_beer}/mk-sums.sh | 0 .../11_bottles_of_beer}/solution.py | 0 .../11_bottles_of_beer}/sums.txt | 0 .../11_bottles_of_beer}/test.py | 0 {12_ransom => 00_TODO/12_ransom}/Makefile | 0 {12_ransom => 00_TODO/12_ransom}/README.md | 0 {12_ransom => 00_TODO/12_ransom}/all_test.sh | 0 .../12_ransom}/solution1_for_loop.py | 0 .../12_ransom}/solution2_for_append_list.py | 0 .../12_ransom}/solution3_for_append_string.py | 0 .../12_ransom}/solution4_list_comprehension.py | 0 .../12_ransom}/solution5_shorter_list_comp.py | 0 {12_ransom => 00_TODO/12_ransom}/solution6_map.py | 0 .../12_ransom}/solution7_shorter_map.py | 0 {12_ransom => 00_TODO/12_ransom}/test.py | 0 {13_twelve_days => 00_TODO/13_twelve_days}/Makefile | 0 .../13_twelve_days}/README.md | 0 .../13_twelve_days}/all_test.sh | 0 .../13_twelve_days}/mk-outs.sh | 0 .../13_twelve_days}/solution.py | 0 .../13_twelve_days}/solution_emoji.py | 0 .../13_twelve_days}/test-out/1.out | 0 .../13_twelve_days}/test-out/10.out | 0 .../13_twelve_days}/test-out/11.out | 0 .../13_twelve_days}/test-out/12.out | 0 .../13_twelve_days}/test-out/2.out | 0 .../13_twelve_days}/test-out/3.out | 0 .../13_twelve_days}/test-out/4.out | 0 .../13_twelve_days}/test-out/5.out | 0 .../13_twelve_days}/test-out/6.out | 0 .../13_twelve_days}/test-out/7.out | 0 .../13_twelve_days}/test-out/8.out | 0 .../13_twelve_days}/test-out/9.out | 0 {13_twelve_days => 00_TODO/13_twelve_days}/test.py | 0 {14_rhymer => 00_TODO/14_rhymer}/Makefile | 0 {14_rhymer => 00_TODO/14_rhymer}/README.md | 0 {14_rhymer => 00_TODO/14_rhymer}/all_test.sh | 0 {14_rhymer => 00_TODO/14_rhymer}/solution1_regex.py | 0 .../14_rhymer}/solution2_no_regex.py | 0 .../14_rhymer}/solution3_dict_words.py | 0 {14_rhymer => 00_TODO/14_rhymer}/test.py | 0 .../15_kentucky_friar}/Makefile | 0 .../15_kentucky_friar}/README.md | 0 .../15_kentucky_friar}/all_test.sh | 0 .../15_kentucky_friar}/inputs/banner.txt | 0 .../15_kentucky_friar}/inputs/banner.txt.out | 0 .../15_kentucky_friar}/inputs/blake.txt | 0 .../15_kentucky_friar}/inputs/blake.txt.out | 0 .../15_kentucky_friar}/inputs/dickinson.txt | 0 .../15_kentucky_friar}/inputs/dickinson.txt.out | 0 .../15_kentucky_friar}/inputs/raven.txt | 0 .../15_kentucky_friar}/inputs/raven.txt.out | 0 .../15_kentucky_friar}/inputs/shakespeare.txt | 0 .../15_kentucky_friar}/inputs/shakespeare.txt.out | 0 .../15_kentucky_friar}/mk-outs.sh | 0 .../15_kentucky_friar}/solution1_regex.py | 0 .../15_kentucky_friar}/solution2_re_compile.py | 0 .../15_kentucky_friar}/solution3_no_regex.py | 0 .../15_kentucky_friar}/test.py | 0 {16_scrambler => 00_TODO/16_scrambler}/Makefile | 0 {16_scrambler => 00_TODO/16_scrambler}/README.md | 0 {16_scrambler => 00_TODO/16_scrambler}/all_test.sh | 0 {16_scrambler => 00_TODO/16_scrambler}/intro.txt | 0 {16_scrambler => 00_TODO/16_scrambler}/solution.py | 0 {16_scrambler => 00_TODO/16_scrambler}/test.py | 0 {17_mad_libs => 00_TODO/17_mad_libs}/Makefile | 0 {17_mad_libs => 00_TODO/17_mad_libs}/README.md | 0 {17_mad_libs => 00_TODO/17_mad_libs}/all_test.sh | 0 {17_mad_libs => 00_TODO/17_mad_libs}/inputs/fox.txt | 0 .../17_mad_libs}/inputs/help.txt | 0 .../17_mad_libs}/inputs/no_blanks.txt | 0 .../17_mad_libs}/inputs/romeo_juliet.txt | 0 .../17_mad_libs}/solution1_regex.py | 0 .../17_mad_libs}/solution2_no_regex.py | 0 {17_mad_libs => 00_TODO/17_mad_libs}/test.py | 0 {18_gematria => 00_TODO/18_gematria}/Makefile | 0 {18_gematria => 00_TODO/18_gematria}/README.md | 0 {18_gematria => 00_TODO/18_gematria}/all_test.sh | 0 {18_gematria => 00_TODO/18_gematria}/asciitbl.py | 0 {18_gematria => 00_TODO/18_gematria}/solution.py | 0 {18_gematria => 00_TODO/18_gematria}/test.py | 0 {18_gematria => 00_TODO/18_gematria}/words.txt | 0 {19_wod => 00_TODO/19_wod}/Makefile | 0 {19_wod => 00_TODO/19_wod}/README.md | 0 {19_wod => 00_TODO/19_wod}/all_test.sh | 0 {19_wod => 00_TODO/19_wod}/inputs/bad-delimiter.tab | 0 {19_wod => 00_TODO/19_wod}/inputs/bad-empty.csv | 0 .../19_wod}/inputs/bad-headers-only.csv | 0 {19_wod => 00_TODO/19_wod}/inputs/bad-headers.csv | 0 {19_wod => 00_TODO/19_wod}/inputs/bad-reps.csv | 0 {19_wod => 00_TODO/19_wod}/inputs/exercises.csv | 0 .../19_wod}/inputs/silly-exercises.csv | 0 {19_wod => 00_TODO/19_wod}/manual1.py | 0 .../19_wod}/manual2_list_comprehension.py | 0 {19_wod => 00_TODO/19_wod}/manual3_map.py | 0 {19_wod => 00_TODO/19_wod}/requirements.txt | 0 {19_wod => 00_TODO/19_wod}/solution1.py | 0 {19_wod => 00_TODO/19_wod}/solution2.py | 0 {19_wod => 00_TODO/19_wod}/test.py | 0 {19_wod => 00_TODO/19_wod}/unit.py | 0 {19_wod => 00_TODO/19_wod}/using_csv1.py | 0 {19_wod => 00_TODO/19_wod}/using_csv2.py | 0 {19_wod => 00_TODO/19_wod}/using_csv3.py | 0 {19_wod => 00_TODO/19_wod}/using_pandas.py | 0 {20_password => 00_TODO/20_password}/Makefile | 0 {20_password => 00_TODO/20_password}/README.md | 0 {20_password => 00_TODO/20_password}/all_test.sh | 0 {20_password => 00_TODO/20_password}/const/adjs.txt | 0 .../20_password}/const/nouns.txt | 0 .../20_password}/const/verbs.txt | 0 {20_password => 00_TODO/20_password}/harvest.py | 0 .../20_password}/scarlet/adjs.txt | 0 .../20_password}/scarlet/nouns.txt | 0 .../20_password}/scarlet/verbs.txt | 0 {20_password => 00_TODO/20_password}/solution.py | 0 .../20_password}/sonnets/adjs.txt | 0 .../20_password}/sonnets/nouns.txt | 0 .../20_password}/sonnets/verbs.txt | 0 {20_password => 00_TODO/20_password}/test.py | 0 {20_password => 00_TODO/20_password}/unit.py | 0 {21_tictactoe => 00_TODO/21_tictactoe}/Makefile | 0 {21_tictactoe => 00_TODO/21_tictactoe}/README.md | 0 {21_tictactoe => 00_TODO/21_tictactoe}/all_test.sh | 0 {21_tictactoe => 00_TODO/21_tictactoe}/solution1.py | 0 {21_tictactoe => 00_TODO/21_tictactoe}/solution2.py | 0 {21_tictactoe => 00_TODO/21_tictactoe}/test.py | 0 {21_tictactoe => 00_TODO/21_tictactoe}/unit.py | 0 {22_itictactoe => 00_TODO/22_itictactoe}/Makefile | 0 {22_itictactoe => 00_TODO/22_itictactoe}/README.md | 0 .../22_itictactoe}/solution1.py | 0 .../22_itictactoe}/solution2_typed_dict.py | 0 .../22_itictactoe}/typehints.py | 0 .../22_itictactoe}/typehints2.py | 0 {22_itictactoe => 00_TODO/22_itictactoe}/unit.py | 0 {appendix => 00_TODO/appendix}/Makefile | 0 {appendix => 00_TODO/appendix}/SETUP_WINDOWS.adoc | 0 {appendix => 00_TODO/appendix}/SETUP_WINDOWS.pdf | Bin .../appendix_argparse}/README.md | 0 .../appendix_argparse}/cat_n.py | 0 .../appendix_argparse}/cat_n_manual.py | 0 .../appendix_argparse}/choices.py | 0 .../appendix_argparse}/manual.py | 0 .../appendix_argparse}/nargs+.py | 0 .../appendix_argparse}/nargs2.py | 0 .../appendix_argparse}/one_arg.py | 0 .../appendix_argparse}/two_args.py | 0 {docker => 00_TODO/docker}/Dockerfile | 0 {docker => 00_TODO/docker}/Makefile | 0 {docker => 00_TODO/docker}/README.md | 0 {extra => 00_TODO/extra}/02_dna/Makefile | 0 {extra => 00_TODO/extra}/02_dna/README.adoc | 0 {extra => 00_TODO/extra}/02_dna/README.pdf | Bin {extra => 00_TODO/extra}/02_dna/test.py | 0 {extra => 00_TODO/extra}/02_spanish/Makefile | 0 {extra => 00_TODO/extra}/02_spanish/README.adoc | 0 {extra => 00_TODO/extra}/02_spanish/README.pdf | Bin {extra => 00_TODO/extra}/02_spanish/test.py | 0 {extra => 00_TODO/extra}/02_strings/Makefile | 0 {extra => 00_TODO/extra}/02_strings/README.adoc | 0 {extra => 00_TODO/extra}/02_strings/README.pdf | Bin {extra => 00_TODO/extra}/02_strings/test.py | 0 {extra => 00_TODO/extra}/03_lister/Makefile | 0 {extra => 00_TODO/extra}/03_lister/README.adoc | 0 {extra => 00_TODO/extra}/03_lister/README.pdf | Bin {extra => 00_TODO/extra}/03_lister/test.py | 0 {extra => 00_TODO/extra}/04_days/Makefile | 0 {extra => 00_TODO/extra}/04_days/README.adoc | 0 {extra => 00_TODO/extra}/04_days/README.pdf | Bin {extra => 00_TODO/extra}/04_days/test.py | 0 {extra => 00_TODO/extra}/06_head/Makefile | 0 {extra => 00_TODO/extra}/06_head/README.adoc | 0 .../extra}/06_head/inputs/gettysburg.txt | 0 .../extra}/06_head/inputs/sonnet-29.txt | 0 .../extra}/06_head/inputs/the-bustle.txt | 0 {extra => 00_TODO/extra}/06_head/test.py | 0 {extra => 00_TODO/extra}/07_proteins/Makefile | 0 {extra => 00_TODO/extra}/07_proteins/README.adoc | 0 {extra => 00_TODO/extra}/07_proteins/README.pdf | Bin {extra => 00_TODO/extra}/07_proteins/codons.dna | 0 {extra => 00_TODO/extra}/07_proteins/codons.rna | 0 {extra => 00_TODO/extra}/07_proteins/input.dna | 0 {extra => 00_TODO/extra}/07_proteins/input.rna | 0 {extra => 00_TODO/extra}/07_proteins/test.py | 0 {extra => 00_TODO/extra}/08_rna/Makefile | 0 {extra => 00_TODO/extra}/08_rna/README.adoc | 0 {extra => 00_TODO/extra}/08_rna/README.pdf | Bin {extra => 00_TODO/extra}/08_rna/inputs/input1.txt | 0 {extra => 00_TODO/extra}/08_rna/inputs/input2.txt | 0 {extra => 00_TODO/extra}/08_rna/test.py | 0 {extra => 00_TODO/extra}/09_moog/Makefile | 0 {extra => 00_TODO/extra}/09_moog/README.adoc | 0 {extra => 00_TODO/extra}/09_moog/README.pdf | Bin {extra => 00_TODO/extra}/09_moog/test.py | 0 {extra => 00_TODO/extra}/10_whitmans/.gitignore | 0 {extra => 00_TODO/extra}/10_whitmans/Makefile | 0 {extra => 00_TODO/extra}/10_whitmans/README.adoc | 0 {extra => 00_TODO/extra}/10_whitmans/README.pdf | Bin .../extra}/10_whitmans/requirements.txt | 0 {extra => 00_TODO/extra}/10_whitmans/solution.py | 0 {extra => 00_TODO/extra}/10_whitmans/test.py | 0 {extra => 00_TODO/extra}/Makefile | 0 {extra => 00_TODO/extra}/README.md | 0 278 files changed, 0 insertions(+), 0 deletions(-) rename {02_crowsnest => 00_TODO/02_crowsnest}/Makefile (100%) rename {02_crowsnest => 00_TODO/02_crowsnest}/README.md (100%) rename {02_crowsnest => 00_TODO/02_crowsnest}/all_test.sh (100%) mode change 100755 => 100644 rename {02_crowsnest => 00_TODO/02_crowsnest}/solution.py (100%) mode change 100755 => 100644 rename {02_crowsnest => 00_TODO/02_crowsnest}/test.py (100%) mode change 100755 => 100644 rename {03_picnic => 00_TODO/03_picnic}/Makefile (100%) rename {03_picnic => 00_TODO/03_picnic}/README.md (100%) rename {03_picnic => 00_TODO/03_picnic}/all_test.sh (100%) mode change 100755 => 100644 rename {03_picnic => 00_TODO/03_picnic}/solution.py (100%) mode change 100755 => 100644 rename {03_picnic => 00_TODO/03_picnic}/test.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/Makefile (100%) rename {04_jump_the_five => 00_TODO/04_jump_the_five}/README.md (100%) rename {04_jump_the_five => 00_TODO/04_jump_the_five}/all_test.sh (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/solution1.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/solution2.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/solution3.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/solution4.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/solution5.py (100%) mode change 100755 => 100644 rename {04_jump_the_five => 00_TODO/04_jump_the_five}/test.py (100%) mode change 100755 => 100644 rename {05_howler => 00_TODO/05_howler}/.gitignore (100%) rename {05_howler => 00_TODO/05_howler}/Makefile (100%) rename {05_howler => 00_TODO/05_howler}/README.md (100%) rename {05_howler => 00_TODO/05_howler}/all_test.sh (100%) mode change 100755 => 100644 rename {05_howler => 00_TODO/05_howler}/mk-test-out.sh (100%) mode change 100755 => 100644 rename {05_howler => 00_TODO/05_howler}/solution1.py (100%) mode change 100755 => 100644 rename {05_howler => 00_TODO/05_howler}/solution2.py (100%) mode change 100755 => 100644 rename {05_howler => 00_TODO/05_howler}/test-outs/preamble.txt (100%) rename {05_howler => 00_TODO/05_howler}/test-outs/sonnet-29.txt (100%) rename {05_howler => 00_TODO/05_howler}/test-outs/the-bustle.txt (100%) rename {05_howler => 00_TODO/05_howler}/test.py (100%) mode change 100755 => 100644 rename {06_wc => 00_TODO/06_wc}/Makefile (100%) rename {06_wc => 00_TODO/06_wc}/README.md (100%) rename {06_wc => 00_TODO/06_wc}/all_test.sh (100%) mode change 100755 => 100644 rename {06_wc => 00_TODO/06_wc}/inputs/empty.txt (100%) rename {06_wc => 00_TODO/06_wc}/inputs/foo.txt (100%) rename {06_wc => 00_TODO/06_wc}/inputs/one.txt (100%) rename {06_wc => 00_TODO/06_wc}/inputs/two.txt (100%) rename {06_wc => 00_TODO/06_wc}/solution.py (100%) mode change 100755 => 100644 rename {06_wc => 00_TODO/06_wc}/test.py (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/Makefile (100%) rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/README.md (100%) rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/all_test.sh (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/alternate.txt (100%) rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/gashlycrumb.txt (100%) rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/gashlycrumb_interactive.py (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/solution1.py (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/solution2_dict_comp.py (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/solution3_dict_get.py (100%) mode change 100755 => 100644 rename {07_gashlycrumb => 00_TODO/07_gashlycrumb}/test.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/Makefile (100%) rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/README.md (100%) rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/all_test.sh (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution1_iterate_chars.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution2_str_replace.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution3_str_translate.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution4_list_comprehension.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution5.1_no_closure.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution5_list_comp_function.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution6_map_lambda.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution7_map_function.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/solution8_regex.py (100%) mode change 100755 => 100644 rename {08_apples_and_bananas => 00_TODO/08_apples_and_bananas}/test.py (100%) mode change 100755 => 100644 rename {09_abuse => 00_TODO/09_abuse}/Makefile (100%) rename {09_abuse => 00_TODO/09_abuse}/README.md (100%) rename {09_abuse => 00_TODO/09_abuse}/all_test.sh (100%) mode change 100755 => 100644 rename {09_abuse => 00_TODO/09_abuse}/solution.py (100%) mode change 100755 => 100644 rename {09_abuse => 00_TODO/09_abuse}/test.py (100%) mode change 100755 => 100644 rename {10_telephone => 00_TODO/10_telephone}/Makefile (100%) rename {10_telephone => 00_TODO/10_telephone}/README.md (100%) rename {10_telephone => 00_TODO/10_telephone}/all_test.sh (100%) mode change 100755 => 100644 rename {10_telephone => 00_TODO/10_telephone}/solution1.py (100%) mode change 100755 => 100644 rename {10_telephone => 00_TODO/10_telephone}/solution2_list.py (100%) mode change 100755 => 100644 rename {10_telephone => 00_TODO/10_telephone}/test.py (100%) mode change 100755 => 100644 rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/Makefile (100%) rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/README.md (100%) rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/all_test.sh (100%) mode change 100755 => 100644 rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/mk-sums.sh (100%) mode change 100755 => 100644 rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/solution.py (100%) mode change 100755 => 100644 rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/sums.txt (100%) rename {11_bottles_of_beer => 00_TODO/11_bottles_of_beer}/test.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/Makefile (100%) rename {12_ransom => 00_TODO/12_ransom}/README.md (100%) rename {12_ransom => 00_TODO/12_ransom}/all_test.sh (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution1_for_loop.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution2_for_append_list.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution3_for_append_string.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution4_list_comprehension.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution5_shorter_list_comp.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution6_map.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/solution7_shorter_map.py (100%) mode change 100755 => 100644 rename {12_ransom => 00_TODO/12_ransom}/test.py (100%) mode change 100755 => 100644 rename {13_twelve_days => 00_TODO/13_twelve_days}/Makefile (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/README.md (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/all_test.sh (100%) mode change 100755 => 100644 rename {13_twelve_days => 00_TODO/13_twelve_days}/mk-outs.sh (100%) mode change 100755 => 100644 rename {13_twelve_days => 00_TODO/13_twelve_days}/solution.py (100%) mode change 100755 => 100644 rename {13_twelve_days => 00_TODO/13_twelve_days}/solution_emoji.py (100%) mode change 100755 => 100644 rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/1.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/10.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/11.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/12.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/2.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/3.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/4.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/5.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/6.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/7.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/8.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test-out/9.out (100%) rename {13_twelve_days => 00_TODO/13_twelve_days}/test.py (100%) mode change 100755 => 100644 rename {14_rhymer => 00_TODO/14_rhymer}/Makefile (100%) rename {14_rhymer => 00_TODO/14_rhymer}/README.md (100%) rename {14_rhymer => 00_TODO/14_rhymer}/all_test.sh (100%) mode change 100755 => 100644 rename {14_rhymer => 00_TODO/14_rhymer}/solution1_regex.py (100%) mode change 100755 => 100644 rename {14_rhymer => 00_TODO/14_rhymer}/solution2_no_regex.py (100%) mode change 100755 => 100644 rename {14_rhymer => 00_TODO/14_rhymer}/solution3_dict_words.py (100%) mode change 100755 => 100644 rename {14_rhymer => 00_TODO/14_rhymer}/test.py (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/Makefile (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/README.md (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/all_test.sh (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/banner.txt (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/banner.txt.out (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/blake.txt (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/blake.txt.out (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/dickinson.txt (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/dickinson.txt.out (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/raven.txt (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/raven.txt.out (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/shakespeare.txt (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/inputs/shakespeare.txt.out (100%) rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/mk-outs.sh (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/solution1_regex.py (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/solution2_re_compile.py (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/solution3_no_regex.py (100%) mode change 100755 => 100644 rename {15_kentucky_friar => 00_TODO/15_kentucky_friar}/test.py (100%) mode change 100755 => 100644 rename {16_scrambler => 00_TODO/16_scrambler}/Makefile (100%) rename {16_scrambler => 00_TODO/16_scrambler}/README.md (100%) rename {16_scrambler => 00_TODO/16_scrambler}/all_test.sh (100%) mode change 100755 => 100644 rename {16_scrambler => 00_TODO/16_scrambler}/intro.txt (100%) rename {16_scrambler => 00_TODO/16_scrambler}/solution.py (100%) mode change 100755 => 100644 rename {16_scrambler => 00_TODO/16_scrambler}/test.py (100%) mode change 100755 => 100644 rename {17_mad_libs => 00_TODO/17_mad_libs}/Makefile (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/README.md (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/all_test.sh (100%) mode change 100755 => 100644 rename {17_mad_libs => 00_TODO/17_mad_libs}/inputs/fox.txt (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/inputs/help.txt (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/inputs/no_blanks.txt (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/inputs/romeo_juliet.txt (100%) rename {17_mad_libs => 00_TODO/17_mad_libs}/solution1_regex.py (100%) mode change 100755 => 100644 rename {17_mad_libs => 00_TODO/17_mad_libs}/solution2_no_regex.py (100%) mode change 100755 => 100644 rename {17_mad_libs => 00_TODO/17_mad_libs}/test.py (100%) mode change 100755 => 100644 rename {18_gematria => 00_TODO/18_gematria}/Makefile (100%) rename {18_gematria => 00_TODO/18_gematria}/README.md (100%) rename {18_gematria => 00_TODO/18_gematria}/all_test.sh (100%) mode change 100755 => 100644 rename {18_gematria => 00_TODO/18_gematria}/asciitbl.py (100%) mode change 100755 => 100644 rename {18_gematria => 00_TODO/18_gematria}/solution.py (100%) mode change 100755 => 100644 rename {18_gematria => 00_TODO/18_gematria}/test.py (100%) mode change 100755 => 100644 rename {18_gematria => 00_TODO/18_gematria}/words.txt (100%) rename {19_wod => 00_TODO/19_wod}/Makefile (100%) rename {19_wod => 00_TODO/19_wod}/README.md (100%) rename {19_wod => 00_TODO/19_wod}/all_test.sh (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/inputs/bad-delimiter.tab (100%) rename {19_wod => 00_TODO/19_wod}/inputs/bad-empty.csv (100%) rename {19_wod => 00_TODO/19_wod}/inputs/bad-headers-only.csv (100%) rename {19_wod => 00_TODO/19_wod}/inputs/bad-headers.csv (100%) rename {19_wod => 00_TODO/19_wod}/inputs/bad-reps.csv (100%) rename {19_wod => 00_TODO/19_wod}/inputs/exercises.csv (100%) rename {19_wod => 00_TODO/19_wod}/inputs/silly-exercises.csv (100%) rename {19_wod => 00_TODO/19_wod}/manual1.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/manual2_list_comprehension.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/manual3_map.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/requirements.txt (100%) rename {19_wod => 00_TODO/19_wod}/solution1.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/solution2.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/test.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/unit.py (100%) rename {19_wod => 00_TODO/19_wod}/using_csv1.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/using_csv2.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/using_csv3.py (100%) mode change 100755 => 100644 rename {19_wod => 00_TODO/19_wod}/using_pandas.py (100%) mode change 100755 => 100644 rename {20_password => 00_TODO/20_password}/Makefile (100%) rename {20_password => 00_TODO/20_password}/README.md (100%) rename {20_password => 00_TODO/20_password}/all_test.sh (100%) mode change 100755 => 100644 rename {20_password => 00_TODO/20_password}/const/adjs.txt (100%) rename {20_password => 00_TODO/20_password}/const/nouns.txt (100%) rename {20_password => 00_TODO/20_password}/const/verbs.txt (100%) rename {20_password => 00_TODO/20_password}/harvest.py (100%) mode change 100755 => 100644 rename {20_password => 00_TODO/20_password}/scarlet/adjs.txt (100%) rename {20_password => 00_TODO/20_password}/scarlet/nouns.txt (100%) rename {20_password => 00_TODO/20_password}/scarlet/verbs.txt (100%) rename {20_password => 00_TODO/20_password}/solution.py (100%) mode change 100755 => 100644 rename {20_password => 00_TODO/20_password}/sonnets/adjs.txt (100%) rename {20_password => 00_TODO/20_password}/sonnets/nouns.txt (100%) rename {20_password => 00_TODO/20_password}/sonnets/verbs.txt (100%) rename {20_password => 00_TODO/20_password}/test.py (100%) mode change 100755 => 100644 rename {20_password => 00_TODO/20_password}/unit.py (100%) rename {21_tictactoe => 00_TODO/21_tictactoe}/Makefile (100%) rename {21_tictactoe => 00_TODO/21_tictactoe}/README.md (100%) rename {21_tictactoe => 00_TODO/21_tictactoe}/all_test.sh (100%) mode change 100755 => 100644 rename {21_tictactoe => 00_TODO/21_tictactoe}/solution1.py (100%) mode change 100755 => 100644 rename {21_tictactoe => 00_TODO/21_tictactoe}/solution2.py (100%) mode change 100755 => 100644 rename {21_tictactoe => 00_TODO/21_tictactoe}/test.py (100%) mode change 100755 => 100644 rename {21_tictactoe => 00_TODO/21_tictactoe}/unit.py (100%) mode change 100755 => 100644 rename {22_itictactoe => 00_TODO/22_itictactoe}/Makefile (100%) rename {22_itictactoe => 00_TODO/22_itictactoe}/README.md (100%) rename {22_itictactoe => 00_TODO/22_itictactoe}/solution1.py (100%) mode change 100755 => 100644 rename {22_itictactoe => 00_TODO/22_itictactoe}/solution2_typed_dict.py (100%) mode change 100755 => 100644 rename {22_itictactoe => 00_TODO/22_itictactoe}/typehints.py (100%) mode change 100755 => 100644 rename {22_itictactoe => 00_TODO/22_itictactoe}/typehints2.py (100%) mode change 100755 => 100644 rename {22_itictactoe => 00_TODO/22_itictactoe}/unit.py (100%) mode change 100755 => 100644 rename {appendix => 00_TODO/appendix}/Makefile (100%) rename {appendix => 00_TODO/appendix}/SETUP_WINDOWS.adoc (100%) rename {appendix => 00_TODO/appendix}/SETUP_WINDOWS.pdf (100%) rename {appendix_argparse => 00_TODO/appendix_argparse}/README.md (100%) rename {appendix_argparse => 00_TODO/appendix_argparse}/cat_n.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/cat_n_manual.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/choices.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/manual.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/nargs+.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/nargs2.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/one_arg.py (100%) mode change 100755 => 100644 rename {appendix_argparse => 00_TODO/appendix_argparse}/two_args.py (100%) mode change 100755 => 100644 rename {docker => 00_TODO/docker}/Dockerfile (100%) rename {docker => 00_TODO/docker}/Makefile (100%) rename {docker => 00_TODO/docker}/README.md (100%) rename {extra => 00_TODO/extra}/02_dna/Makefile (100%) rename {extra => 00_TODO/extra}/02_dna/README.adoc (100%) rename {extra => 00_TODO/extra}/02_dna/README.pdf (100%) rename {extra => 00_TODO/extra}/02_dna/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/02_spanish/Makefile (100%) rename {extra => 00_TODO/extra}/02_spanish/README.adoc (100%) rename {extra => 00_TODO/extra}/02_spanish/README.pdf (100%) rename {extra => 00_TODO/extra}/02_spanish/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/02_strings/Makefile (100%) rename {extra => 00_TODO/extra}/02_strings/README.adoc (100%) rename {extra => 00_TODO/extra}/02_strings/README.pdf (100%) rename {extra => 00_TODO/extra}/02_strings/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/03_lister/Makefile (100%) rename {extra => 00_TODO/extra}/03_lister/README.adoc (100%) rename {extra => 00_TODO/extra}/03_lister/README.pdf (100%) rename {extra => 00_TODO/extra}/03_lister/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/04_days/Makefile (100%) rename {extra => 00_TODO/extra}/04_days/README.adoc (100%) rename {extra => 00_TODO/extra}/04_days/README.pdf (100%) rename {extra => 00_TODO/extra}/04_days/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/06_head/Makefile (100%) rename {extra => 00_TODO/extra}/06_head/README.adoc (100%) rename {extra => 00_TODO/extra}/06_head/inputs/gettysburg.txt (100%) rename {extra => 00_TODO/extra}/06_head/inputs/sonnet-29.txt (100%) rename {extra => 00_TODO/extra}/06_head/inputs/the-bustle.txt (100%) rename {extra => 00_TODO/extra}/06_head/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/07_proteins/Makefile (100%) rename {extra => 00_TODO/extra}/07_proteins/README.adoc (100%) rename {extra => 00_TODO/extra}/07_proteins/README.pdf (100%) rename {extra => 00_TODO/extra}/07_proteins/codons.dna (100%) rename {extra => 00_TODO/extra}/07_proteins/codons.rna (100%) rename {extra => 00_TODO/extra}/07_proteins/input.dna (100%) rename {extra => 00_TODO/extra}/07_proteins/input.rna (100%) rename {extra => 00_TODO/extra}/07_proteins/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/08_rna/Makefile (100%) rename {extra => 00_TODO/extra}/08_rna/README.adoc (100%) rename {extra => 00_TODO/extra}/08_rna/README.pdf (100%) rename {extra => 00_TODO/extra}/08_rna/inputs/input1.txt (100%) rename {extra => 00_TODO/extra}/08_rna/inputs/input2.txt (100%) rename {extra => 00_TODO/extra}/08_rna/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/09_moog/Makefile (100%) rename {extra => 00_TODO/extra}/09_moog/README.adoc (100%) rename {extra => 00_TODO/extra}/09_moog/README.pdf (100%) rename {extra => 00_TODO/extra}/09_moog/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/10_whitmans/.gitignore (100%) rename {extra => 00_TODO/extra}/10_whitmans/Makefile (100%) rename {extra => 00_TODO/extra}/10_whitmans/README.adoc (100%) rename {extra => 00_TODO/extra}/10_whitmans/README.pdf (100%) rename {extra => 00_TODO/extra}/10_whitmans/requirements.txt (100%) rename {extra => 00_TODO/extra}/10_whitmans/solution.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/10_whitmans/test.py (100%) mode change 100755 => 100644 rename {extra => 00_TODO/extra}/Makefile (100%) rename {extra => 00_TODO/extra}/README.md (100%) diff --git a/02_crowsnest/Makefile b/00_TODO/02_crowsnest/Makefile similarity index 100% rename from 02_crowsnest/Makefile rename to 00_TODO/02_crowsnest/Makefile diff --git a/02_crowsnest/README.md b/00_TODO/02_crowsnest/README.md similarity index 100% rename from 02_crowsnest/README.md rename to 00_TODO/02_crowsnest/README.md diff --git a/02_crowsnest/all_test.sh b/00_TODO/02_crowsnest/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 02_crowsnest/all_test.sh rename to 00_TODO/02_crowsnest/all_test.sh diff --git a/02_crowsnest/solution.py b/00_TODO/02_crowsnest/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 02_crowsnest/solution.py rename to 00_TODO/02_crowsnest/solution.py diff --git a/02_crowsnest/test.py b/00_TODO/02_crowsnest/test.py old mode 100755 new mode 100644 similarity index 100% rename from 02_crowsnest/test.py rename to 00_TODO/02_crowsnest/test.py diff --git a/03_picnic/Makefile b/00_TODO/03_picnic/Makefile similarity index 100% rename from 03_picnic/Makefile rename to 00_TODO/03_picnic/Makefile diff --git a/03_picnic/README.md b/00_TODO/03_picnic/README.md similarity index 100% rename from 03_picnic/README.md rename to 00_TODO/03_picnic/README.md diff --git a/03_picnic/all_test.sh b/00_TODO/03_picnic/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 03_picnic/all_test.sh rename to 00_TODO/03_picnic/all_test.sh diff --git a/03_picnic/solution.py b/00_TODO/03_picnic/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 03_picnic/solution.py rename to 00_TODO/03_picnic/solution.py diff --git a/03_picnic/test.py b/00_TODO/03_picnic/test.py old mode 100755 new mode 100644 similarity index 100% rename from 03_picnic/test.py rename to 00_TODO/03_picnic/test.py diff --git a/04_jump_the_five/Makefile b/00_TODO/04_jump_the_five/Makefile similarity index 100% rename from 04_jump_the_five/Makefile rename to 00_TODO/04_jump_the_five/Makefile diff --git a/04_jump_the_five/README.md b/00_TODO/04_jump_the_five/README.md similarity index 100% rename from 04_jump_the_five/README.md rename to 00_TODO/04_jump_the_five/README.md diff --git a/04_jump_the_five/all_test.sh b/00_TODO/04_jump_the_five/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/all_test.sh rename to 00_TODO/04_jump_the_five/all_test.sh diff --git a/04_jump_the_five/solution1.py b/00_TODO/04_jump_the_five/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/solution1.py rename to 00_TODO/04_jump_the_five/solution1.py diff --git a/04_jump_the_five/solution2.py b/00_TODO/04_jump_the_five/solution2.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/solution2.py rename to 00_TODO/04_jump_the_five/solution2.py diff --git a/04_jump_the_five/solution3.py b/00_TODO/04_jump_the_five/solution3.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/solution3.py rename to 00_TODO/04_jump_the_five/solution3.py diff --git a/04_jump_the_five/solution4.py b/00_TODO/04_jump_the_five/solution4.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/solution4.py rename to 00_TODO/04_jump_the_five/solution4.py diff --git a/04_jump_the_five/solution5.py b/00_TODO/04_jump_the_five/solution5.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/solution5.py rename to 00_TODO/04_jump_the_five/solution5.py diff --git a/04_jump_the_five/test.py b/00_TODO/04_jump_the_five/test.py old mode 100755 new mode 100644 similarity index 100% rename from 04_jump_the_five/test.py rename to 00_TODO/04_jump_the_five/test.py diff --git a/05_howler/.gitignore b/00_TODO/05_howler/.gitignore similarity index 100% rename from 05_howler/.gitignore rename to 00_TODO/05_howler/.gitignore diff --git a/05_howler/Makefile b/00_TODO/05_howler/Makefile similarity index 100% rename from 05_howler/Makefile rename to 00_TODO/05_howler/Makefile diff --git a/05_howler/README.md b/00_TODO/05_howler/README.md similarity index 100% rename from 05_howler/README.md rename to 00_TODO/05_howler/README.md diff --git a/05_howler/all_test.sh b/00_TODO/05_howler/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 05_howler/all_test.sh rename to 00_TODO/05_howler/all_test.sh diff --git a/05_howler/mk-test-out.sh b/00_TODO/05_howler/mk-test-out.sh old mode 100755 new mode 100644 similarity index 100% rename from 05_howler/mk-test-out.sh rename to 00_TODO/05_howler/mk-test-out.sh diff --git a/05_howler/solution1.py b/00_TODO/05_howler/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 05_howler/solution1.py rename to 00_TODO/05_howler/solution1.py diff --git a/05_howler/solution2.py b/00_TODO/05_howler/solution2.py old mode 100755 new mode 100644 similarity index 100% rename from 05_howler/solution2.py rename to 00_TODO/05_howler/solution2.py diff --git a/05_howler/test-outs/preamble.txt b/00_TODO/05_howler/test-outs/preamble.txt similarity index 100% rename from 05_howler/test-outs/preamble.txt rename to 00_TODO/05_howler/test-outs/preamble.txt diff --git a/05_howler/test-outs/sonnet-29.txt b/00_TODO/05_howler/test-outs/sonnet-29.txt similarity index 100% rename from 05_howler/test-outs/sonnet-29.txt rename to 00_TODO/05_howler/test-outs/sonnet-29.txt diff --git a/05_howler/test-outs/the-bustle.txt b/00_TODO/05_howler/test-outs/the-bustle.txt similarity index 100% rename from 05_howler/test-outs/the-bustle.txt rename to 00_TODO/05_howler/test-outs/the-bustle.txt diff --git a/05_howler/test.py b/00_TODO/05_howler/test.py old mode 100755 new mode 100644 similarity index 100% rename from 05_howler/test.py rename to 00_TODO/05_howler/test.py diff --git a/06_wc/Makefile b/00_TODO/06_wc/Makefile similarity index 100% rename from 06_wc/Makefile rename to 00_TODO/06_wc/Makefile diff --git a/06_wc/README.md b/00_TODO/06_wc/README.md similarity index 100% rename from 06_wc/README.md rename to 00_TODO/06_wc/README.md diff --git a/06_wc/all_test.sh b/00_TODO/06_wc/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 06_wc/all_test.sh rename to 00_TODO/06_wc/all_test.sh diff --git a/06_wc/inputs/empty.txt b/00_TODO/06_wc/inputs/empty.txt similarity index 100% rename from 06_wc/inputs/empty.txt rename to 00_TODO/06_wc/inputs/empty.txt diff --git a/06_wc/inputs/foo.txt b/00_TODO/06_wc/inputs/foo.txt similarity index 100% rename from 06_wc/inputs/foo.txt rename to 00_TODO/06_wc/inputs/foo.txt diff --git a/06_wc/inputs/one.txt b/00_TODO/06_wc/inputs/one.txt similarity index 100% rename from 06_wc/inputs/one.txt rename to 00_TODO/06_wc/inputs/one.txt diff --git a/06_wc/inputs/two.txt b/00_TODO/06_wc/inputs/two.txt similarity index 100% rename from 06_wc/inputs/two.txt rename to 00_TODO/06_wc/inputs/two.txt diff --git a/06_wc/solution.py b/00_TODO/06_wc/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 06_wc/solution.py rename to 00_TODO/06_wc/solution.py diff --git a/06_wc/test.py b/00_TODO/06_wc/test.py old mode 100755 new mode 100644 similarity index 100% rename from 06_wc/test.py rename to 00_TODO/06_wc/test.py diff --git a/07_gashlycrumb/Makefile b/00_TODO/07_gashlycrumb/Makefile similarity index 100% rename from 07_gashlycrumb/Makefile rename to 00_TODO/07_gashlycrumb/Makefile diff --git a/07_gashlycrumb/README.md b/00_TODO/07_gashlycrumb/README.md similarity index 100% rename from 07_gashlycrumb/README.md rename to 00_TODO/07_gashlycrumb/README.md diff --git a/07_gashlycrumb/all_test.sh b/00_TODO/07_gashlycrumb/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/all_test.sh rename to 00_TODO/07_gashlycrumb/all_test.sh diff --git a/07_gashlycrumb/alternate.txt b/00_TODO/07_gashlycrumb/alternate.txt similarity index 100% rename from 07_gashlycrumb/alternate.txt rename to 00_TODO/07_gashlycrumb/alternate.txt diff --git a/07_gashlycrumb/gashlycrumb.txt b/00_TODO/07_gashlycrumb/gashlycrumb.txt similarity index 100% rename from 07_gashlycrumb/gashlycrumb.txt rename to 00_TODO/07_gashlycrumb/gashlycrumb.txt diff --git a/07_gashlycrumb/gashlycrumb_interactive.py b/00_TODO/07_gashlycrumb/gashlycrumb_interactive.py old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/gashlycrumb_interactive.py rename to 00_TODO/07_gashlycrumb/gashlycrumb_interactive.py diff --git a/07_gashlycrumb/solution1.py b/00_TODO/07_gashlycrumb/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/solution1.py rename to 00_TODO/07_gashlycrumb/solution1.py diff --git a/07_gashlycrumb/solution2_dict_comp.py b/00_TODO/07_gashlycrumb/solution2_dict_comp.py old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/solution2_dict_comp.py rename to 00_TODO/07_gashlycrumb/solution2_dict_comp.py diff --git a/07_gashlycrumb/solution3_dict_get.py b/00_TODO/07_gashlycrumb/solution3_dict_get.py old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/solution3_dict_get.py rename to 00_TODO/07_gashlycrumb/solution3_dict_get.py diff --git a/07_gashlycrumb/test.py b/00_TODO/07_gashlycrumb/test.py old mode 100755 new mode 100644 similarity index 100% rename from 07_gashlycrumb/test.py rename to 00_TODO/07_gashlycrumb/test.py diff --git a/08_apples_and_bananas/Makefile b/00_TODO/08_apples_and_bananas/Makefile similarity index 100% rename from 08_apples_and_bananas/Makefile rename to 00_TODO/08_apples_and_bananas/Makefile diff --git a/08_apples_and_bananas/README.md b/00_TODO/08_apples_and_bananas/README.md similarity index 100% rename from 08_apples_and_bananas/README.md rename to 00_TODO/08_apples_and_bananas/README.md diff --git a/08_apples_and_bananas/all_test.sh b/00_TODO/08_apples_and_bananas/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/all_test.sh rename to 00_TODO/08_apples_and_bananas/all_test.sh diff --git a/08_apples_and_bananas/solution1_iterate_chars.py b/00_TODO/08_apples_and_bananas/solution1_iterate_chars.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution1_iterate_chars.py rename to 00_TODO/08_apples_and_bananas/solution1_iterate_chars.py diff --git a/08_apples_and_bananas/solution2_str_replace.py b/00_TODO/08_apples_and_bananas/solution2_str_replace.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution2_str_replace.py rename to 00_TODO/08_apples_and_bananas/solution2_str_replace.py diff --git a/08_apples_and_bananas/solution3_str_translate.py b/00_TODO/08_apples_and_bananas/solution3_str_translate.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution3_str_translate.py rename to 00_TODO/08_apples_and_bananas/solution3_str_translate.py diff --git a/08_apples_and_bananas/solution4_list_comprehension.py b/00_TODO/08_apples_and_bananas/solution4_list_comprehension.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution4_list_comprehension.py rename to 00_TODO/08_apples_and_bananas/solution4_list_comprehension.py diff --git a/08_apples_and_bananas/solution5.1_no_closure.py b/00_TODO/08_apples_and_bananas/solution5.1_no_closure.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution5.1_no_closure.py rename to 00_TODO/08_apples_and_bananas/solution5.1_no_closure.py diff --git a/08_apples_and_bananas/solution5_list_comp_function.py b/00_TODO/08_apples_and_bananas/solution5_list_comp_function.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution5_list_comp_function.py rename to 00_TODO/08_apples_and_bananas/solution5_list_comp_function.py diff --git a/08_apples_and_bananas/solution6_map_lambda.py b/00_TODO/08_apples_and_bananas/solution6_map_lambda.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution6_map_lambda.py rename to 00_TODO/08_apples_and_bananas/solution6_map_lambda.py diff --git a/08_apples_and_bananas/solution7_map_function.py b/00_TODO/08_apples_and_bananas/solution7_map_function.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution7_map_function.py rename to 00_TODO/08_apples_and_bananas/solution7_map_function.py diff --git a/08_apples_and_bananas/solution8_regex.py b/00_TODO/08_apples_and_bananas/solution8_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/solution8_regex.py rename to 00_TODO/08_apples_and_bananas/solution8_regex.py diff --git a/08_apples_and_bananas/test.py b/00_TODO/08_apples_and_bananas/test.py old mode 100755 new mode 100644 similarity index 100% rename from 08_apples_and_bananas/test.py rename to 00_TODO/08_apples_and_bananas/test.py diff --git a/09_abuse/Makefile b/00_TODO/09_abuse/Makefile similarity index 100% rename from 09_abuse/Makefile rename to 00_TODO/09_abuse/Makefile diff --git a/09_abuse/README.md b/00_TODO/09_abuse/README.md similarity index 100% rename from 09_abuse/README.md rename to 00_TODO/09_abuse/README.md diff --git a/09_abuse/all_test.sh b/00_TODO/09_abuse/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 09_abuse/all_test.sh rename to 00_TODO/09_abuse/all_test.sh diff --git a/09_abuse/solution.py b/00_TODO/09_abuse/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 09_abuse/solution.py rename to 00_TODO/09_abuse/solution.py diff --git a/09_abuse/test.py b/00_TODO/09_abuse/test.py old mode 100755 new mode 100644 similarity index 100% rename from 09_abuse/test.py rename to 00_TODO/09_abuse/test.py diff --git a/10_telephone/Makefile b/00_TODO/10_telephone/Makefile similarity index 100% rename from 10_telephone/Makefile rename to 00_TODO/10_telephone/Makefile diff --git a/10_telephone/README.md b/00_TODO/10_telephone/README.md similarity index 100% rename from 10_telephone/README.md rename to 00_TODO/10_telephone/README.md diff --git a/10_telephone/all_test.sh b/00_TODO/10_telephone/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 10_telephone/all_test.sh rename to 00_TODO/10_telephone/all_test.sh diff --git a/10_telephone/solution1.py b/00_TODO/10_telephone/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 10_telephone/solution1.py rename to 00_TODO/10_telephone/solution1.py diff --git a/10_telephone/solution2_list.py b/00_TODO/10_telephone/solution2_list.py old mode 100755 new mode 100644 similarity index 100% rename from 10_telephone/solution2_list.py rename to 00_TODO/10_telephone/solution2_list.py diff --git a/10_telephone/test.py b/00_TODO/10_telephone/test.py old mode 100755 new mode 100644 similarity index 100% rename from 10_telephone/test.py rename to 00_TODO/10_telephone/test.py diff --git a/11_bottles_of_beer/Makefile b/00_TODO/11_bottles_of_beer/Makefile similarity index 100% rename from 11_bottles_of_beer/Makefile rename to 00_TODO/11_bottles_of_beer/Makefile diff --git a/11_bottles_of_beer/README.md b/00_TODO/11_bottles_of_beer/README.md similarity index 100% rename from 11_bottles_of_beer/README.md rename to 00_TODO/11_bottles_of_beer/README.md diff --git a/11_bottles_of_beer/all_test.sh b/00_TODO/11_bottles_of_beer/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 11_bottles_of_beer/all_test.sh rename to 00_TODO/11_bottles_of_beer/all_test.sh diff --git a/11_bottles_of_beer/mk-sums.sh b/00_TODO/11_bottles_of_beer/mk-sums.sh old mode 100755 new mode 100644 similarity index 100% rename from 11_bottles_of_beer/mk-sums.sh rename to 00_TODO/11_bottles_of_beer/mk-sums.sh diff --git a/11_bottles_of_beer/solution.py b/00_TODO/11_bottles_of_beer/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 11_bottles_of_beer/solution.py rename to 00_TODO/11_bottles_of_beer/solution.py diff --git a/11_bottles_of_beer/sums.txt b/00_TODO/11_bottles_of_beer/sums.txt similarity index 100% rename from 11_bottles_of_beer/sums.txt rename to 00_TODO/11_bottles_of_beer/sums.txt diff --git a/11_bottles_of_beer/test.py b/00_TODO/11_bottles_of_beer/test.py old mode 100755 new mode 100644 similarity index 100% rename from 11_bottles_of_beer/test.py rename to 00_TODO/11_bottles_of_beer/test.py diff --git a/12_ransom/Makefile b/00_TODO/12_ransom/Makefile similarity index 100% rename from 12_ransom/Makefile rename to 00_TODO/12_ransom/Makefile diff --git a/12_ransom/README.md b/00_TODO/12_ransom/README.md similarity index 100% rename from 12_ransom/README.md rename to 00_TODO/12_ransom/README.md diff --git a/12_ransom/all_test.sh b/00_TODO/12_ransom/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/all_test.sh rename to 00_TODO/12_ransom/all_test.sh diff --git a/12_ransom/solution1_for_loop.py b/00_TODO/12_ransom/solution1_for_loop.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution1_for_loop.py rename to 00_TODO/12_ransom/solution1_for_loop.py diff --git a/12_ransom/solution2_for_append_list.py b/00_TODO/12_ransom/solution2_for_append_list.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution2_for_append_list.py rename to 00_TODO/12_ransom/solution2_for_append_list.py diff --git a/12_ransom/solution3_for_append_string.py b/00_TODO/12_ransom/solution3_for_append_string.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution3_for_append_string.py rename to 00_TODO/12_ransom/solution3_for_append_string.py diff --git a/12_ransom/solution4_list_comprehension.py b/00_TODO/12_ransom/solution4_list_comprehension.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution4_list_comprehension.py rename to 00_TODO/12_ransom/solution4_list_comprehension.py diff --git a/12_ransom/solution5_shorter_list_comp.py b/00_TODO/12_ransom/solution5_shorter_list_comp.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution5_shorter_list_comp.py rename to 00_TODO/12_ransom/solution5_shorter_list_comp.py diff --git a/12_ransom/solution6_map.py b/00_TODO/12_ransom/solution6_map.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution6_map.py rename to 00_TODO/12_ransom/solution6_map.py diff --git a/12_ransom/solution7_shorter_map.py b/00_TODO/12_ransom/solution7_shorter_map.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/solution7_shorter_map.py rename to 00_TODO/12_ransom/solution7_shorter_map.py diff --git a/12_ransom/test.py b/00_TODO/12_ransom/test.py old mode 100755 new mode 100644 similarity index 100% rename from 12_ransom/test.py rename to 00_TODO/12_ransom/test.py diff --git a/13_twelve_days/Makefile b/00_TODO/13_twelve_days/Makefile similarity index 100% rename from 13_twelve_days/Makefile rename to 00_TODO/13_twelve_days/Makefile diff --git a/13_twelve_days/README.md b/00_TODO/13_twelve_days/README.md similarity index 100% rename from 13_twelve_days/README.md rename to 00_TODO/13_twelve_days/README.md diff --git a/13_twelve_days/all_test.sh b/00_TODO/13_twelve_days/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 13_twelve_days/all_test.sh rename to 00_TODO/13_twelve_days/all_test.sh diff --git a/13_twelve_days/mk-outs.sh b/00_TODO/13_twelve_days/mk-outs.sh old mode 100755 new mode 100644 similarity index 100% rename from 13_twelve_days/mk-outs.sh rename to 00_TODO/13_twelve_days/mk-outs.sh diff --git a/13_twelve_days/solution.py b/00_TODO/13_twelve_days/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 13_twelve_days/solution.py rename to 00_TODO/13_twelve_days/solution.py diff --git a/13_twelve_days/solution_emoji.py b/00_TODO/13_twelve_days/solution_emoji.py old mode 100755 new mode 100644 similarity index 100% rename from 13_twelve_days/solution_emoji.py rename to 00_TODO/13_twelve_days/solution_emoji.py diff --git a/13_twelve_days/test-out/1.out b/00_TODO/13_twelve_days/test-out/1.out similarity index 100% rename from 13_twelve_days/test-out/1.out rename to 00_TODO/13_twelve_days/test-out/1.out diff --git a/13_twelve_days/test-out/10.out b/00_TODO/13_twelve_days/test-out/10.out similarity index 100% rename from 13_twelve_days/test-out/10.out rename to 00_TODO/13_twelve_days/test-out/10.out diff --git a/13_twelve_days/test-out/11.out b/00_TODO/13_twelve_days/test-out/11.out similarity index 100% rename from 13_twelve_days/test-out/11.out rename to 00_TODO/13_twelve_days/test-out/11.out diff --git a/13_twelve_days/test-out/12.out b/00_TODO/13_twelve_days/test-out/12.out similarity index 100% rename from 13_twelve_days/test-out/12.out rename to 00_TODO/13_twelve_days/test-out/12.out diff --git a/13_twelve_days/test-out/2.out b/00_TODO/13_twelve_days/test-out/2.out similarity index 100% rename from 13_twelve_days/test-out/2.out rename to 00_TODO/13_twelve_days/test-out/2.out diff --git a/13_twelve_days/test-out/3.out b/00_TODO/13_twelve_days/test-out/3.out similarity index 100% rename from 13_twelve_days/test-out/3.out rename to 00_TODO/13_twelve_days/test-out/3.out diff --git a/13_twelve_days/test-out/4.out b/00_TODO/13_twelve_days/test-out/4.out similarity index 100% rename from 13_twelve_days/test-out/4.out rename to 00_TODO/13_twelve_days/test-out/4.out diff --git a/13_twelve_days/test-out/5.out b/00_TODO/13_twelve_days/test-out/5.out similarity index 100% rename from 13_twelve_days/test-out/5.out rename to 00_TODO/13_twelve_days/test-out/5.out diff --git a/13_twelve_days/test-out/6.out b/00_TODO/13_twelve_days/test-out/6.out similarity index 100% rename from 13_twelve_days/test-out/6.out rename to 00_TODO/13_twelve_days/test-out/6.out diff --git a/13_twelve_days/test-out/7.out b/00_TODO/13_twelve_days/test-out/7.out similarity index 100% rename from 13_twelve_days/test-out/7.out rename to 00_TODO/13_twelve_days/test-out/7.out diff --git a/13_twelve_days/test-out/8.out b/00_TODO/13_twelve_days/test-out/8.out similarity index 100% rename from 13_twelve_days/test-out/8.out rename to 00_TODO/13_twelve_days/test-out/8.out diff --git a/13_twelve_days/test-out/9.out b/00_TODO/13_twelve_days/test-out/9.out similarity index 100% rename from 13_twelve_days/test-out/9.out rename to 00_TODO/13_twelve_days/test-out/9.out diff --git a/13_twelve_days/test.py b/00_TODO/13_twelve_days/test.py old mode 100755 new mode 100644 similarity index 100% rename from 13_twelve_days/test.py rename to 00_TODO/13_twelve_days/test.py diff --git a/14_rhymer/Makefile b/00_TODO/14_rhymer/Makefile similarity index 100% rename from 14_rhymer/Makefile rename to 00_TODO/14_rhymer/Makefile diff --git a/14_rhymer/README.md b/00_TODO/14_rhymer/README.md similarity index 100% rename from 14_rhymer/README.md rename to 00_TODO/14_rhymer/README.md diff --git a/14_rhymer/all_test.sh b/00_TODO/14_rhymer/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 14_rhymer/all_test.sh rename to 00_TODO/14_rhymer/all_test.sh diff --git a/14_rhymer/solution1_regex.py b/00_TODO/14_rhymer/solution1_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 14_rhymer/solution1_regex.py rename to 00_TODO/14_rhymer/solution1_regex.py diff --git a/14_rhymer/solution2_no_regex.py b/00_TODO/14_rhymer/solution2_no_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 14_rhymer/solution2_no_regex.py rename to 00_TODO/14_rhymer/solution2_no_regex.py diff --git a/14_rhymer/solution3_dict_words.py b/00_TODO/14_rhymer/solution3_dict_words.py old mode 100755 new mode 100644 similarity index 100% rename from 14_rhymer/solution3_dict_words.py rename to 00_TODO/14_rhymer/solution3_dict_words.py diff --git a/14_rhymer/test.py b/00_TODO/14_rhymer/test.py old mode 100755 new mode 100644 similarity index 100% rename from 14_rhymer/test.py rename to 00_TODO/14_rhymer/test.py diff --git a/15_kentucky_friar/Makefile b/00_TODO/15_kentucky_friar/Makefile similarity index 100% rename from 15_kentucky_friar/Makefile rename to 00_TODO/15_kentucky_friar/Makefile diff --git a/15_kentucky_friar/README.md b/00_TODO/15_kentucky_friar/README.md similarity index 100% rename from 15_kentucky_friar/README.md rename to 00_TODO/15_kentucky_friar/README.md diff --git a/15_kentucky_friar/all_test.sh b/00_TODO/15_kentucky_friar/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/all_test.sh rename to 00_TODO/15_kentucky_friar/all_test.sh diff --git a/15_kentucky_friar/inputs/banner.txt b/00_TODO/15_kentucky_friar/inputs/banner.txt similarity index 100% rename from 15_kentucky_friar/inputs/banner.txt rename to 00_TODO/15_kentucky_friar/inputs/banner.txt diff --git a/15_kentucky_friar/inputs/banner.txt.out b/00_TODO/15_kentucky_friar/inputs/banner.txt.out similarity index 100% rename from 15_kentucky_friar/inputs/banner.txt.out rename to 00_TODO/15_kentucky_friar/inputs/banner.txt.out diff --git a/15_kentucky_friar/inputs/blake.txt b/00_TODO/15_kentucky_friar/inputs/blake.txt similarity index 100% rename from 15_kentucky_friar/inputs/blake.txt rename to 00_TODO/15_kentucky_friar/inputs/blake.txt diff --git a/15_kentucky_friar/inputs/blake.txt.out b/00_TODO/15_kentucky_friar/inputs/blake.txt.out similarity index 100% rename from 15_kentucky_friar/inputs/blake.txt.out rename to 00_TODO/15_kentucky_friar/inputs/blake.txt.out diff --git a/15_kentucky_friar/inputs/dickinson.txt b/00_TODO/15_kentucky_friar/inputs/dickinson.txt similarity index 100% rename from 15_kentucky_friar/inputs/dickinson.txt rename to 00_TODO/15_kentucky_friar/inputs/dickinson.txt diff --git a/15_kentucky_friar/inputs/dickinson.txt.out b/00_TODO/15_kentucky_friar/inputs/dickinson.txt.out similarity index 100% rename from 15_kentucky_friar/inputs/dickinson.txt.out rename to 00_TODO/15_kentucky_friar/inputs/dickinson.txt.out diff --git a/15_kentucky_friar/inputs/raven.txt b/00_TODO/15_kentucky_friar/inputs/raven.txt similarity index 100% rename from 15_kentucky_friar/inputs/raven.txt rename to 00_TODO/15_kentucky_friar/inputs/raven.txt diff --git a/15_kentucky_friar/inputs/raven.txt.out b/00_TODO/15_kentucky_friar/inputs/raven.txt.out similarity index 100% rename from 15_kentucky_friar/inputs/raven.txt.out rename to 00_TODO/15_kentucky_friar/inputs/raven.txt.out diff --git a/15_kentucky_friar/inputs/shakespeare.txt b/00_TODO/15_kentucky_friar/inputs/shakespeare.txt similarity index 100% rename from 15_kentucky_friar/inputs/shakespeare.txt rename to 00_TODO/15_kentucky_friar/inputs/shakespeare.txt diff --git a/15_kentucky_friar/inputs/shakespeare.txt.out b/00_TODO/15_kentucky_friar/inputs/shakespeare.txt.out similarity index 100% rename from 15_kentucky_friar/inputs/shakespeare.txt.out rename to 00_TODO/15_kentucky_friar/inputs/shakespeare.txt.out diff --git a/15_kentucky_friar/mk-outs.sh b/00_TODO/15_kentucky_friar/mk-outs.sh old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/mk-outs.sh rename to 00_TODO/15_kentucky_friar/mk-outs.sh diff --git a/15_kentucky_friar/solution1_regex.py b/00_TODO/15_kentucky_friar/solution1_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/solution1_regex.py rename to 00_TODO/15_kentucky_friar/solution1_regex.py diff --git a/15_kentucky_friar/solution2_re_compile.py b/00_TODO/15_kentucky_friar/solution2_re_compile.py old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/solution2_re_compile.py rename to 00_TODO/15_kentucky_friar/solution2_re_compile.py diff --git a/15_kentucky_friar/solution3_no_regex.py b/00_TODO/15_kentucky_friar/solution3_no_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/solution3_no_regex.py rename to 00_TODO/15_kentucky_friar/solution3_no_regex.py diff --git a/15_kentucky_friar/test.py b/00_TODO/15_kentucky_friar/test.py old mode 100755 new mode 100644 similarity index 100% rename from 15_kentucky_friar/test.py rename to 00_TODO/15_kentucky_friar/test.py diff --git a/16_scrambler/Makefile b/00_TODO/16_scrambler/Makefile similarity index 100% rename from 16_scrambler/Makefile rename to 00_TODO/16_scrambler/Makefile diff --git a/16_scrambler/README.md b/00_TODO/16_scrambler/README.md similarity index 100% rename from 16_scrambler/README.md rename to 00_TODO/16_scrambler/README.md diff --git a/16_scrambler/all_test.sh b/00_TODO/16_scrambler/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 16_scrambler/all_test.sh rename to 00_TODO/16_scrambler/all_test.sh diff --git a/16_scrambler/intro.txt b/00_TODO/16_scrambler/intro.txt similarity index 100% rename from 16_scrambler/intro.txt rename to 00_TODO/16_scrambler/intro.txt diff --git a/16_scrambler/solution.py b/00_TODO/16_scrambler/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 16_scrambler/solution.py rename to 00_TODO/16_scrambler/solution.py diff --git a/16_scrambler/test.py b/00_TODO/16_scrambler/test.py old mode 100755 new mode 100644 similarity index 100% rename from 16_scrambler/test.py rename to 00_TODO/16_scrambler/test.py diff --git a/17_mad_libs/Makefile b/00_TODO/17_mad_libs/Makefile similarity index 100% rename from 17_mad_libs/Makefile rename to 00_TODO/17_mad_libs/Makefile diff --git a/17_mad_libs/README.md b/00_TODO/17_mad_libs/README.md similarity index 100% rename from 17_mad_libs/README.md rename to 00_TODO/17_mad_libs/README.md diff --git a/17_mad_libs/all_test.sh b/00_TODO/17_mad_libs/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 17_mad_libs/all_test.sh rename to 00_TODO/17_mad_libs/all_test.sh diff --git a/17_mad_libs/inputs/fox.txt b/00_TODO/17_mad_libs/inputs/fox.txt similarity index 100% rename from 17_mad_libs/inputs/fox.txt rename to 00_TODO/17_mad_libs/inputs/fox.txt diff --git a/17_mad_libs/inputs/help.txt b/00_TODO/17_mad_libs/inputs/help.txt similarity index 100% rename from 17_mad_libs/inputs/help.txt rename to 00_TODO/17_mad_libs/inputs/help.txt diff --git a/17_mad_libs/inputs/no_blanks.txt b/00_TODO/17_mad_libs/inputs/no_blanks.txt similarity index 100% rename from 17_mad_libs/inputs/no_blanks.txt rename to 00_TODO/17_mad_libs/inputs/no_blanks.txt diff --git a/17_mad_libs/inputs/romeo_juliet.txt b/00_TODO/17_mad_libs/inputs/romeo_juliet.txt similarity index 100% rename from 17_mad_libs/inputs/romeo_juliet.txt rename to 00_TODO/17_mad_libs/inputs/romeo_juliet.txt diff --git a/17_mad_libs/solution1_regex.py b/00_TODO/17_mad_libs/solution1_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 17_mad_libs/solution1_regex.py rename to 00_TODO/17_mad_libs/solution1_regex.py diff --git a/17_mad_libs/solution2_no_regex.py b/00_TODO/17_mad_libs/solution2_no_regex.py old mode 100755 new mode 100644 similarity index 100% rename from 17_mad_libs/solution2_no_regex.py rename to 00_TODO/17_mad_libs/solution2_no_regex.py diff --git a/17_mad_libs/test.py b/00_TODO/17_mad_libs/test.py old mode 100755 new mode 100644 similarity index 100% rename from 17_mad_libs/test.py rename to 00_TODO/17_mad_libs/test.py diff --git a/18_gematria/Makefile b/00_TODO/18_gematria/Makefile similarity index 100% rename from 18_gematria/Makefile rename to 00_TODO/18_gematria/Makefile diff --git a/18_gematria/README.md b/00_TODO/18_gematria/README.md similarity index 100% rename from 18_gematria/README.md rename to 00_TODO/18_gematria/README.md diff --git a/18_gematria/all_test.sh b/00_TODO/18_gematria/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 18_gematria/all_test.sh rename to 00_TODO/18_gematria/all_test.sh diff --git a/18_gematria/asciitbl.py b/00_TODO/18_gematria/asciitbl.py old mode 100755 new mode 100644 similarity index 100% rename from 18_gematria/asciitbl.py rename to 00_TODO/18_gematria/asciitbl.py diff --git a/18_gematria/solution.py b/00_TODO/18_gematria/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 18_gematria/solution.py rename to 00_TODO/18_gematria/solution.py diff --git a/18_gematria/test.py b/00_TODO/18_gematria/test.py old mode 100755 new mode 100644 similarity index 100% rename from 18_gematria/test.py rename to 00_TODO/18_gematria/test.py diff --git a/18_gematria/words.txt b/00_TODO/18_gematria/words.txt similarity index 100% rename from 18_gematria/words.txt rename to 00_TODO/18_gematria/words.txt diff --git a/19_wod/Makefile b/00_TODO/19_wod/Makefile similarity index 100% rename from 19_wod/Makefile rename to 00_TODO/19_wod/Makefile diff --git a/19_wod/README.md b/00_TODO/19_wod/README.md similarity index 100% rename from 19_wod/README.md rename to 00_TODO/19_wod/README.md diff --git a/19_wod/all_test.sh b/00_TODO/19_wod/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/all_test.sh rename to 00_TODO/19_wod/all_test.sh diff --git a/19_wod/inputs/bad-delimiter.tab b/00_TODO/19_wod/inputs/bad-delimiter.tab similarity index 100% rename from 19_wod/inputs/bad-delimiter.tab rename to 00_TODO/19_wod/inputs/bad-delimiter.tab diff --git a/19_wod/inputs/bad-empty.csv b/00_TODO/19_wod/inputs/bad-empty.csv similarity index 100% rename from 19_wod/inputs/bad-empty.csv rename to 00_TODO/19_wod/inputs/bad-empty.csv diff --git a/19_wod/inputs/bad-headers-only.csv b/00_TODO/19_wod/inputs/bad-headers-only.csv similarity index 100% rename from 19_wod/inputs/bad-headers-only.csv rename to 00_TODO/19_wod/inputs/bad-headers-only.csv diff --git a/19_wod/inputs/bad-headers.csv b/00_TODO/19_wod/inputs/bad-headers.csv similarity index 100% rename from 19_wod/inputs/bad-headers.csv rename to 00_TODO/19_wod/inputs/bad-headers.csv diff --git a/19_wod/inputs/bad-reps.csv b/00_TODO/19_wod/inputs/bad-reps.csv similarity index 100% rename from 19_wod/inputs/bad-reps.csv rename to 00_TODO/19_wod/inputs/bad-reps.csv diff --git a/19_wod/inputs/exercises.csv b/00_TODO/19_wod/inputs/exercises.csv similarity index 100% rename from 19_wod/inputs/exercises.csv rename to 00_TODO/19_wod/inputs/exercises.csv diff --git a/19_wod/inputs/silly-exercises.csv b/00_TODO/19_wod/inputs/silly-exercises.csv similarity index 100% rename from 19_wod/inputs/silly-exercises.csv rename to 00_TODO/19_wod/inputs/silly-exercises.csv diff --git a/19_wod/manual1.py b/00_TODO/19_wod/manual1.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/manual1.py rename to 00_TODO/19_wod/manual1.py diff --git a/19_wod/manual2_list_comprehension.py b/00_TODO/19_wod/manual2_list_comprehension.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/manual2_list_comprehension.py rename to 00_TODO/19_wod/manual2_list_comprehension.py diff --git a/19_wod/manual3_map.py b/00_TODO/19_wod/manual3_map.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/manual3_map.py rename to 00_TODO/19_wod/manual3_map.py diff --git a/19_wod/requirements.txt b/00_TODO/19_wod/requirements.txt similarity index 100% rename from 19_wod/requirements.txt rename to 00_TODO/19_wod/requirements.txt diff --git a/19_wod/solution1.py b/00_TODO/19_wod/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/solution1.py rename to 00_TODO/19_wod/solution1.py diff --git a/19_wod/solution2.py b/00_TODO/19_wod/solution2.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/solution2.py rename to 00_TODO/19_wod/solution2.py diff --git a/19_wod/test.py b/00_TODO/19_wod/test.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/test.py rename to 00_TODO/19_wod/test.py diff --git a/19_wod/unit.py b/00_TODO/19_wod/unit.py similarity index 100% rename from 19_wod/unit.py rename to 00_TODO/19_wod/unit.py diff --git a/19_wod/using_csv1.py b/00_TODO/19_wod/using_csv1.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/using_csv1.py rename to 00_TODO/19_wod/using_csv1.py diff --git a/19_wod/using_csv2.py b/00_TODO/19_wod/using_csv2.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/using_csv2.py rename to 00_TODO/19_wod/using_csv2.py diff --git a/19_wod/using_csv3.py b/00_TODO/19_wod/using_csv3.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/using_csv3.py rename to 00_TODO/19_wod/using_csv3.py diff --git a/19_wod/using_pandas.py b/00_TODO/19_wod/using_pandas.py old mode 100755 new mode 100644 similarity index 100% rename from 19_wod/using_pandas.py rename to 00_TODO/19_wod/using_pandas.py diff --git a/20_password/Makefile b/00_TODO/20_password/Makefile similarity index 100% rename from 20_password/Makefile rename to 00_TODO/20_password/Makefile diff --git a/20_password/README.md b/00_TODO/20_password/README.md similarity index 100% rename from 20_password/README.md rename to 00_TODO/20_password/README.md diff --git a/20_password/all_test.sh b/00_TODO/20_password/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 20_password/all_test.sh rename to 00_TODO/20_password/all_test.sh diff --git a/20_password/const/adjs.txt b/00_TODO/20_password/const/adjs.txt similarity index 100% rename from 20_password/const/adjs.txt rename to 00_TODO/20_password/const/adjs.txt diff --git a/20_password/const/nouns.txt b/00_TODO/20_password/const/nouns.txt similarity index 100% rename from 20_password/const/nouns.txt rename to 00_TODO/20_password/const/nouns.txt diff --git a/20_password/const/verbs.txt b/00_TODO/20_password/const/verbs.txt similarity index 100% rename from 20_password/const/verbs.txt rename to 00_TODO/20_password/const/verbs.txt diff --git a/20_password/harvest.py b/00_TODO/20_password/harvest.py old mode 100755 new mode 100644 similarity index 100% rename from 20_password/harvest.py rename to 00_TODO/20_password/harvest.py diff --git a/20_password/scarlet/adjs.txt b/00_TODO/20_password/scarlet/adjs.txt similarity index 100% rename from 20_password/scarlet/adjs.txt rename to 00_TODO/20_password/scarlet/adjs.txt diff --git a/20_password/scarlet/nouns.txt b/00_TODO/20_password/scarlet/nouns.txt similarity index 100% rename from 20_password/scarlet/nouns.txt rename to 00_TODO/20_password/scarlet/nouns.txt diff --git a/20_password/scarlet/verbs.txt b/00_TODO/20_password/scarlet/verbs.txt similarity index 100% rename from 20_password/scarlet/verbs.txt rename to 00_TODO/20_password/scarlet/verbs.txt diff --git a/20_password/solution.py b/00_TODO/20_password/solution.py old mode 100755 new mode 100644 similarity index 100% rename from 20_password/solution.py rename to 00_TODO/20_password/solution.py diff --git a/20_password/sonnets/adjs.txt b/00_TODO/20_password/sonnets/adjs.txt similarity index 100% rename from 20_password/sonnets/adjs.txt rename to 00_TODO/20_password/sonnets/adjs.txt diff --git a/20_password/sonnets/nouns.txt b/00_TODO/20_password/sonnets/nouns.txt similarity index 100% rename from 20_password/sonnets/nouns.txt rename to 00_TODO/20_password/sonnets/nouns.txt diff --git a/20_password/sonnets/verbs.txt b/00_TODO/20_password/sonnets/verbs.txt similarity index 100% rename from 20_password/sonnets/verbs.txt rename to 00_TODO/20_password/sonnets/verbs.txt diff --git a/20_password/test.py b/00_TODO/20_password/test.py old mode 100755 new mode 100644 similarity index 100% rename from 20_password/test.py rename to 00_TODO/20_password/test.py diff --git a/20_password/unit.py b/00_TODO/20_password/unit.py similarity index 100% rename from 20_password/unit.py rename to 00_TODO/20_password/unit.py diff --git a/21_tictactoe/Makefile b/00_TODO/21_tictactoe/Makefile similarity index 100% rename from 21_tictactoe/Makefile rename to 00_TODO/21_tictactoe/Makefile diff --git a/21_tictactoe/README.md b/00_TODO/21_tictactoe/README.md similarity index 100% rename from 21_tictactoe/README.md rename to 00_TODO/21_tictactoe/README.md diff --git a/21_tictactoe/all_test.sh b/00_TODO/21_tictactoe/all_test.sh old mode 100755 new mode 100644 similarity index 100% rename from 21_tictactoe/all_test.sh rename to 00_TODO/21_tictactoe/all_test.sh diff --git a/21_tictactoe/solution1.py b/00_TODO/21_tictactoe/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 21_tictactoe/solution1.py rename to 00_TODO/21_tictactoe/solution1.py diff --git a/21_tictactoe/solution2.py b/00_TODO/21_tictactoe/solution2.py old mode 100755 new mode 100644 similarity index 100% rename from 21_tictactoe/solution2.py rename to 00_TODO/21_tictactoe/solution2.py diff --git a/21_tictactoe/test.py b/00_TODO/21_tictactoe/test.py old mode 100755 new mode 100644 similarity index 100% rename from 21_tictactoe/test.py rename to 00_TODO/21_tictactoe/test.py diff --git a/21_tictactoe/unit.py b/00_TODO/21_tictactoe/unit.py old mode 100755 new mode 100644 similarity index 100% rename from 21_tictactoe/unit.py rename to 00_TODO/21_tictactoe/unit.py diff --git a/22_itictactoe/Makefile b/00_TODO/22_itictactoe/Makefile similarity index 100% rename from 22_itictactoe/Makefile rename to 00_TODO/22_itictactoe/Makefile diff --git a/22_itictactoe/README.md b/00_TODO/22_itictactoe/README.md similarity index 100% rename from 22_itictactoe/README.md rename to 00_TODO/22_itictactoe/README.md diff --git a/22_itictactoe/solution1.py b/00_TODO/22_itictactoe/solution1.py old mode 100755 new mode 100644 similarity index 100% rename from 22_itictactoe/solution1.py rename to 00_TODO/22_itictactoe/solution1.py diff --git a/22_itictactoe/solution2_typed_dict.py b/00_TODO/22_itictactoe/solution2_typed_dict.py old mode 100755 new mode 100644 similarity index 100% rename from 22_itictactoe/solution2_typed_dict.py rename to 00_TODO/22_itictactoe/solution2_typed_dict.py diff --git a/22_itictactoe/typehints.py b/00_TODO/22_itictactoe/typehints.py old mode 100755 new mode 100644 similarity index 100% rename from 22_itictactoe/typehints.py rename to 00_TODO/22_itictactoe/typehints.py diff --git a/22_itictactoe/typehints2.py b/00_TODO/22_itictactoe/typehints2.py old mode 100755 new mode 100644 similarity index 100% rename from 22_itictactoe/typehints2.py rename to 00_TODO/22_itictactoe/typehints2.py diff --git a/22_itictactoe/unit.py b/00_TODO/22_itictactoe/unit.py old mode 100755 new mode 100644 similarity index 100% rename from 22_itictactoe/unit.py rename to 00_TODO/22_itictactoe/unit.py diff --git a/appendix/Makefile b/00_TODO/appendix/Makefile similarity index 100% rename from appendix/Makefile rename to 00_TODO/appendix/Makefile diff --git a/appendix/SETUP_WINDOWS.adoc b/00_TODO/appendix/SETUP_WINDOWS.adoc similarity index 100% rename from appendix/SETUP_WINDOWS.adoc rename to 00_TODO/appendix/SETUP_WINDOWS.adoc diff --git a/appendix/SETUP_WINDOWS.pdf b/00_TODO/appendix/SETUP_WINDOWS.pdf similarity index 100% rename from appendix/SETUP_WINDOWS.pdf rename to 00_TODO/appendix/SETUP_WINDOWS.pdf diff --git a/appendix_argparse/README.md b/00_TODO/appendix_argparse/README.md similarity index 100% rename from appendix_argparse/README.md rename to 00_TODO/appendix_argparse/README.md diff --git a/appendix_argparse/cat_n.py b/00_TODO/appendix_argparse/cat_n.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/cat_n.py rename to 00_TODO/appendix_argparse/cat_n.py diff --git a/appendix_argparse/cat_n_manual.py b/00_TODO/appendix_argparse/cat_n_manual.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/cat_n_manual.py rename to 00_TODO/appendix_argparse/cat_n_manual.py diff --git a/appendix_argparse/choices.py b/00_TODO/appendix_argparse/choices.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/choices.py rename to 00_TODO/appendix_argparse/choices.py diff --git a/appendix_argparse/manual.py b/00_TODO/appendix_argparse/manual.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/manual.py rename to 00_TODO/appendix_argparse/manual.py diff --git a/appendix_argparse/nargs+.py b/00_TODO/appendix_argparse/nargs+.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/nargs+.py rename to 00_TODO/appendix_argparse/nargs+.py diff --git a/appendix_argparse/nargs2.py b/00_TODO/appendix_argparse/nargs2.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/nargs2.py rename to 00_TODO/appendix_argparse/nargs2.py diff --git a/appendix_argparse/one_arg.py b/00_TODO/appendix_argparse/one_arg.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/one_arg.py rename to 00_TODO/appendix_argparse/one_arg.py diff --git a/appendix_argparse/two_args.py b/00_TODO/appendix_argparse/two_args.py old mode 100755 new mode 100644 similarity index 100% rename from appendix_argparse/two_args.py rename to 00_TODO/appendix_argparse/two_args.py diff --git a/docker/Dockerfile b/00_TODO/docker/Dockerfile similarity index 100% rename from docker/Dockerfile rename to 00_TODO/docker/Dockerfile diff --git a/docker/Makefile b/00_TODO/docker/Makefile similarity index 100% rename from docker/Makefile rename to 00_TODO/docker/Makefile diff --git a/docker/README.md b/00_TODO/docker/README.md similarity index 100% rename from docker/README.md rename to 00_TODO/docker/README.md diff --git a/extra/02_dna/Makefile b/00_TODO/extra/02_dna/Makefile similarity index 100% rename from extra/02_dna/Makefile rename to 00_TODO/extra/02_dna/Makefile diff --git a/extra/02_dna/README.adoc b/00_TODO/extra/02_dna/README.adoc similarity index 100% rename from extra/02_dna/README.adoc rename to 00_TODO/extra/02_dna/README.adoc diff --git a/extra/02_dna/README.pdf b/00_TODO/extra/02_dna/README.pdf similarity index 100% rename from extra/02_dna/README.pdf rename to 00_TODO/extra/02_dna/README.pdf diff --git a/extra/02_dna/test.py b/00_TODO/extra/02_dna/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/02_dna/test.py rename to 00_TODO/extra/02_dna/test.py diff --git a/extra/02_spanish/Makefile b/00_TODO/extra/02_spanish/Makefile similarity index 100% rename from extra/02_spanish/Makefile rename to 00_TODO/extra/02_spanish/Makefile diff --git a/extra/02_spanish/README.adoc b/00_TODO/extra/02_spanish/README.adoc similarity index 100% rename from extra/02_spanish/README.adoc rename to 00_TODO/extra/02_spanish/README.adoc diff --git a/extra/02_spanish/README.pdf b/00_TODO/extra/02_spanish/README.pdf similarity index 100% rename from extra/02_spanish/README.pdf rename to 00_TODO/extra/02_spanish/README.pdf diff --git a/extra/02_spanish/test.py b/00_TODO/extra/02_spanish/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/02_spanish/test.py rename to 00_TODO/extra/02_spanish/test.py diff --git a/extra/02_strings/Makefile b/00_TODO/extra/02_strings/Makefile similarity index 100% rename from extra/02_strings/Makefile rename to 00_TODO/extra/02_strings/Makefile diff --git a/extra/02_strings/README.adoc b/00_TODO/extra/02_strings/README.adoc similarity index 100% rename from extra/02_strings/README.adoc rename to 00_TODO/extra/02_strings/README.adoc diff --git a/extra/02_strings/README.pdf b/00_TODO/extra/02_strings/README.pdf similarity index 100% rename from extra/02_strings/README.pdf rename to 00_TODO/extra/02_strings/README.pdf diff --git a/extra/02_strings/test.py b/00_TODO/extra/02_strings/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/02_strings/test.py rename to 00_TODO/extra/02_strings/test.py diff --git a/extra/03_lister/Makefile b/00_TODO/extra/03_lister/Makefile similarity index 100% rename from extra/03_lister/Makefile rename to 00_TODO/extra/03_lister/Makefile diff --git a/extra/03_lister/README.adoc b/00_TODO/extra/03_lister/README.adoc similarity index 100% rename from extra/03_lister/README.adoc rename to 00_TODO/extra/03_lister/README.adoc diff --git a/extra/03_lister/README.pdf b/00_TODO/extra/03_lister/README.pdf similarity index 100% rename from extra/03_lister/README.pdf rename to 00_TODO/extra/03_lister/README.pdf diff --git a/extra/03_lister/test.py b/00_TODO/extra/03_lister/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/03_lister/test.py rename to 00_TODO/extra/03_lister/test.py diff --git a/extra/04_days/Makefile b/00_TODO/extra/04_days/Makefile similarity index 100% rename from extra/04_days/Makefile rename to 00_TODO/extra/04_days/Makefile diff --git a/extra/04_days/README.adoc b/00_TODO/extra/04_days/README.adoc similarity index 100% rename from extra/04_days/README.adoc rename to 00_TODO/extra/04_days/README.adoc diff --git a/extra/04_days/README.pdf b/00_TODO/extra/04_days/README.pdf similarity index 100% rename from extra/04_days/README.pdf rename to 00_TODO/extra/04_days/README.pdf diff --git a/extra/04_days/test.py b/00_TODO/extra/04_days/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/04_days/test.py rename to 00_TODO/extra/04_days/test.py diff --git a/extra/06_head/Makefile b/00_TODO/extra/06_head/Makefile similarity index 100% rename from extra/06_head/Makefile rename to 00_TODO/extra/06_head/Makefile diff --git a/extra/06_head/README.adoc b/00_TODO/extra/06_head/README.adoc similarity index 100% rename from extra/06_head/README.adoc rename to 00_TODO/extra/06_head/README.adoc diff --git a/extra/06_head/inputs/gettysburg.txt b/00_TODO/extra/06_head/inputs/gettysburg.txt similarity index 100% rename from extra/06_head/inputs/gettysburg.txt rename to 00_TODO/extra/06_head/inputs/gettysburg.txt diff --git a/extra/06_head/inputs/sonnet-29.txt b/00_TODO/extra/06_head/inputs/sonnet-29.txt similarity index 100% rename from extra/06_head/inputs/sonnet-29.txt rename to 00_TODO/extra/06_head/inputs/sonnet-29.txt diff --git a/extra/06_head/inputs/the-bustle.txt b/00_TODO/extra/06_head/inputs/the-bustle.txt similarity index 100% rename from extra/06_head/inputs/the-bustle.txt rename to 00_TODO/extra/06_head/inputs/the-bustle.txt diff --git a/extra/06_head/test.py b/00_TODO/extra/06_head/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/06_head/test.py rename to 00_TODO/extra/06_head/test.py diff --git a/extra/07_proteins/Makefile b/00_TODO/extra/07_proteins/Makefile similarity index 100% rename from extra/07_proteins/Makefile rename to 00_TODO/extra/07_proteins/Makefile diff --git a/extra/07_proteins/README.adoc b/00_TODO/extra/07_proteins/README.adoc similarity index 100% rename from extra/07_proteins/README.adoc rename to 00_TODO/extra/07_proteins/README.adoc diff --git a/extra/07_proteins/README.pdf b/00_TODO/extra/07_proteins/README.pdf similarity index 100% rename from extra/07_proteins/README.pdf rename to 00_TODO/extra/07_proteins/README.pdf diff --git a/extra/07_proteins/codons.dna b/00_TODO/extra/07_proteins/codons.dna similarity index 100% rename from extra/07_proteins/codons.dna rename to 00_TODO/extra/07_proteins/codons.dna diff --git a/extra/07_proteins/codons.rna b/00_TODO/extra/07_proteins/codons.rna similarity index 100% rename from extra/07_proteins/codons.rna rename to 00_TODO/extra/07_proteins/codons.rna diff --git a/extra/07_proteins/input.dna b/00_TODO/extra/07_proteins/input.dna similarity index 100% rename from extra/07_proteins/input.dna rename to 00_TODO/extra/07_proteins/input.dna diff --git a/extra/07_proteins/input.rna b/00_TODO/extra/07_proteins/input.rna similarity index 100% rename from extra/07_proteins/input.rna rename to 00_TODO/extra/07_proteins/input.rna diff --git a/extra/07_proteins/test.py b/00_TODO/extra/07_proteins/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/07_proteins/test.py rename to 00_TODO/extra/07_proteins/test.py diff --git a/extra/08_rna/Makefile b/00_TODO/extra/08_rna/Makefile similarity index 100% rename from extra/08_rna/Makefile rename to 00_TODO/extra/08_rna/Makefile diff --git a/extra/08_rna/README.adoc b/00_TODO/extra/08_rna/README.adoc similarity index 100% rename from extra/08_rna/README.adoc rename to 00_TODO/extra/08_rna/README.adoc diff --git a/extra/08_rna/README.pdf b/00_TODO/extra/08_rna/README.pdf similarity index 100% rename from extra/08_rna/README.pdf rename to 00_TODO/extra/08_rna/README.pdf diff --git a/extra/08_rna/inputs/input1.txt b/00_TODO/extra/08_rna/inputs/input1.txt similarity index 100% rename from extra/08_rna/inputs/input1.txt rename to 00_TODO/extra/08_rna/inputs/input1.txt diff --git a/extra/08_rna/inputs/input2.txt b/00_TODO/extra/08_rna/inputs/input2.txt similarity index 100% rename from extra/08_rna/inputs/input2.txt rename to 00_TODO/extra/08_rna/inputs/input2.txt diff --git a/extra/08_rna/test.py b/00_TODO/extra/08_rna/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/08_rna/test.py rename to 00_TODO/extra/08_rna/test.py diff --git a/extra/09_moog/Makefile b/00_TODO/extra/09_moog/Makefile similarity index 100% rename from extra/09_moog/Makefile rename to 00_TODO/extra/09_moog/Makefile diff --git a/extra/09_moog/README.adoc b/00_TODO/extra/09_moog/README.adoc similarity index 100% rename from extra/09_moog/README.adoc rename to 00_TODO/extra/09_moog/README.adoc diff --git a/extra/09_moog/README.pdf b/00_TODO/extra/09_moog/README.pdf similarity index 100% rename from extra/09_moog/README.pdf rename to 00_TODO/extra/09_moog/README.pdf diff --git a/extra/09_moog/test.py b/00_TODO/extra/09_moog/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/09_moog/test.py rename to 00_TODO/extra/09_moog/test.py diff --git a/extra/10_whitmans/.gitignore b/00_TODO/extra/10_whitmans/.gitignore similarity index 100% rename from extra/10_whitmans/.gitignore rename to 00_TODO/extra/10_whitmans/.gitignore diff --git a/extra/10_whitmans/Makefile b/00_TODO/extra/10_whitmans/Makefile similarity index 100% rename from extra/10_whitmans/Makefile rename to 00_TODO/extra/10_whitmans/Makefile diff --git a/extra/10_whitmans/README.adoc b/00_TODO/extra/10_whitmans/README.adoc similarity index 100% rename from extra/10_whitmans/README.adoc rename to 00_TODO/extra/10_whitmans/README.adoc diff --git a/extra/10_whitmans/README.pdf b/00_TODO/extra/10_whitmans/README.pdf similarity index 100% rename from extra/10_whitmans/README.pdf rename to 00_TODO/extra/10_whitmans/README.pdf diff --git a/extra/10_whitmans/requirements.txt b/00_TODO/extra/10_whitmans/requirements.txt similarity index 100% rename from extra/10_whitmans/requirements.txt rename to 00_TODO/extra/10_whitmans/requirements.txt diff --git a/extra/10_whitmans/solution.py b/00_TODO/extra/10_whitmans/solution.py old mode 100755 new mode 100644 similarity index 100% rename from extra/10_whitmans/solution.py rename to 00_TODO/extra/10_whitmans/solution.py diff --git a/extra/10_whitmans/test.py b/00_TODO/extra/10_whitmans/test.py old mode 100755 new mode 100644 similarity index 100% rename from extra/10_whitmans/test.py rename to 00_TODO/extra/10_whitmans/test.py diff --git a/extra/Makefile b/00_TODO/extra/Makefile similarity index 100% rename from extra/Makefile rename to 00_TODO/extra/Makefile diff --git a/extra/README.md b/00_TODO/extra/README.md similarity index 100% rename from extra/README.md rename to 00_TODO/extra/README.md From 49cd3c75b962d94815e805e5bd5c093c7c399c52 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 15:45:44 -0800 Subject: [PATCH 03/63] Add name argument via argparse --- 01_hello/hello.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/01_hello/hello.py b/01_hello/hello.py index bab4aea59..1ef182ef4 100644 --- a/01_hello/hello.py +++ b/01_hello/hello.py @@ -2,4 +2,11 @@ # Gets python3 from env rather than current session # Purpose: Say Hello -print('Hello, World!') \ No newline at end of file + +import argparse + +parser = argparse.ArgumentParser(description='Say Hello') +parser.add_argument('name', help='Name to greet') +args = parser.parse_args() + +print('Hello, ' + args.name + '!') From 4cd6838ab452e473121bff28f09d625bb7948b2b Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 15:48:32 -0800 Subject: [PATCH 04/63] Make the paramater optional instead of positional --- 01_hello/hello.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_hello/hello.py b/01_hello/hello.py index 1ef182ef4..253da018f 100644 --- a/01_hello/hello.py +++ b/01_hello/hello.py @@ -6,7 +6,7 @@ import argparse parser = argparse.ArgumentParser(description='Say Hello') -parser.add_argument('name', help='Name to greet') +parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet') args = parser.parse_args() print('Hello, ' + args.name + '!') From 6dbeb186df5375e3a5e31d784be11a9b957423a7 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 15:51:59 -0800 Subject: [PATCH 05/63] Update syntax to main --- 01_hello/hello.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/01_hello/hello.py b/01_hello/hello.py index 253da018f..bd0d09267 100644 --- a/01_hello/hello.py +++ b/01_hello/hello.py @@ -5,8 +5,12 @@ import argparse -parser = argparse.ArgumentParser(description='Say Hello') -parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet') -args = parser.parse_args() +def main (): + parser = argparse.ArgumentParser(description='Say Hello') + parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet') + args = parser.parse_args() -print('Hello, ' + args.name + '!') + print('Hello, ' + args.name + '!') + +if __name__ == '__main__': + main() From 172fef6790f932fe65c549e185e232d1dd53ff76 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 15:55:17 -0800 Subject: [PATCH 06/63] Update syntax to split arg processing --- 01_hello/hello.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/01_hello/hello.py b/01_hello/hello.py index bd0d09267..01a2f0ccc 100644 --- a/01_hello/hello.py +++ b/01_hello/hello.py @@ -5,11 +5,13 @@ import argparse -def main (): +def get_args(): parser = argparse.ArgumentParser(description='Say Hello') parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet') - args = parser.parse_args() + return parser.parse_args() +def main (): + args = get_args() print('Hello, ' + args.name + '!') if __name__ == '__main__': From 4588eeb6179c74f7a7469cf62e82fdaf58910250 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 16:01:49 -0800 Subject: [PATCH 07/63] Lint with flake8 --- 01_hello/hello.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/01_hello/hello.py b/01_hello/hello.py index 01a2f0ccc..d10662636 100644 --- a/01_hello/hello.py +++ b/01_hello/hello.py @@ -1,18 +1,30 @@ #!/usr/bin/env python3 -# Gets python3 from env rather than current session - -# Purpose: Say Hello +""" +Author : Fleid +Purpose : Say Hello +""" import argparse + +# ------------------------------------------------------------------------ def get_args(): + """Get the command-line arguments""" + parser = argparse.ArgumentParser(description='Say Hello') - parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet') + parser.add_argument('-n', '--name', + metavar='name', default='World', help='Name to greet') return parser.parse_args() -def main (): + +# ------------------------------------------------------------------------ +def main(): + """ Where things happen""" + args = get_args() print('Hello, ' + args.name + '!') + +# ------------------------------------------------------------------------ if __name__ == '__main__': main() From d1751a2891aede4d01606fda8006a0ae51a28971 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 16:06:29 -0800 Subject: [PATCH 08/63] Update doc --- README_fleide.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/README_fleide.md b/README_fleide.md index 42e35a986..c59b80241 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -38,10 +38,36 @@ bin/new.py HelloWorld.py ## Chapter 1 - Write and test a Python program ```BASH -pytest -v test.py +pytest -v -x test.py ``` Add a shush bang (#!) to get the file executable from the shell Use `which python3` to find which one to link to, then add `#!/usr/bin/python3` to the file Or default to the env via `#!/usr/bin/env python3` to make it portable -Then run with `./hello.py` (if necessary `chmod +x hello.py`) \ No newline at end of file +Then run with `./hello.py` (if necessary `chmod +x hello.py`) + +Nice to have: +- make with a `Makefile` for testing + +### Parameters + +Using `argparse` + + +```Python +import argparse + +parser = argparse.ArgumentParser(description='Say Hello') +#parser.add_argument('name', help='Name to greet, positional') +parser.add_argument('-n', '--name', metavar='name', default='World', help='Name to greet, optional') +args = parser.parse_args() +``` + +### Linting + +```BASH + +flake 8 hello.py +pylint hello.py + +``` \ No newline at end of file From 7e89c6b1ff7035f160fd67cb9352b55587ef9430 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 2 Dec 2020 16:10:33 -0800 Subject: [PATCH 09/63] Try new.py for scaffolding --- 01_hello/hello2.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 01_hello/hello2.py diff --git a/01_hello/hello2.py b/01_hello/hello2.py new file mode 100644 index 000000000..1b3a8975a --- /dev/null +++ b/01_hello/hello2.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2020-12-02 +Purpose: Say Hello +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Say Hello', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('-n', + '--name', + help='A name', + metavar='name', + type=str, + default='Universe') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + + print('Hello ' + args.name + '!') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() From cfb23fe81ef9f8ee3c4b7cd8fa07890024ab1be1 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 15:47:40 -0800 Subject: [PATCH 10/63] Bring back 02 --- {00_TODO/02_crowsnest => 02_crowsnest}/Makefile | 0 {00_TODO/02_crowsnest => 02_crowsnest}/README.md | 0 {00_TODO/02_crowsnest => 02_crowsnest}/all_test.sh | 0 {00_TODO/02_crowsnest => 02_crowsnest}/solution.py | 0 {00_TODO/02_crowsnest => 02_crowsnest}/test.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {00_TODO/02_crowsnest => 02_crowsnest}/Makefile (100%) rename {00_TODO/02_crowsnest => 02_crowsnest}/README.md (100%) rename {00_TODO/02_crowsnest => 02_crowsnest}/all_test.sh (100%) rename {00_TODO/02_crowsnest => 02_crowsnest}/solution.py (100%) rename {00_TODO/02_crowsnest => 02_crowsnest}/test.py (100%) diff --git a/00_TODO/02_crowsnest/Makefile b/02_crowsnest/Makefile similarity index 100% rename from 00_TODO/02_crowsnest/Makefile rename to 02_crowsnest/Makefile diff --git a/00_TODO/02_crowsnest/README.md b/02_crowsnest/README.md similarity index 100% rename from 00_TODO/02_crowsnest/README.md rename to 02_crowsnest/README.md diff --git a/00_TODO/02_crowsnest/all_test.sh b/02_crowsnest/all_test.sh similarity index 100% rename from 00_TODO/02_crowsnest/all_test.sh rename to 02_crowsnest/all_test.sh diff --git a/00_TODO/02_crowsnest/solution.py b/02_crowsnest/solution.py similarity index 100% rename from 00_TODO/02_crowsnest/solution.py rename to 02_crowsnest/solution.py diff --git a/00_TODO/02_crowsnest/test.py b/02_crowsnest/test.py similarity index 100% rename from 00_TODO/02_crowsnest/test.py rename to 02_crowsnest/test.py From 95966153ab30c999d27d708a6ec406caa2584f4d Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 15:59:02 -0800 Subject: [PATCH 11/63] Generate 02 with new.py --- .gitignore | 1 - 02_crowsnest/crowsnest.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 02_crowsnest/crowsnest.py diff --git a/.gitignore b/.gitignore index 68ca39690..c78b21b50 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ tex2pdf* .coverage .idea .vscode -02_crowsnest/crowsnest.py 03_picnic/picnic.py 04_jump_the_five/jump.py 05_howler/howler.py diff --git a/02_crowsnest/crowsnest.py b/02_crowsnest/crowsnest.py new file mode 100644 index 000000000..8a2c8d4b1 --- /dev/null +++ b/02_crowsnest/crowsnest.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2020-12-03 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Look out matey!', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', #name of the parameter in the program + metavar='mob', #name of the parameter for the caller + help='A mobile object ahead') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + pos_arg = args.positional + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() From 4f0eb46d541e11b21a96dd70b461b0c838617411 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 15:59:59 -0800 Subject: [PATCH 12/63] Update gitignore to add main programs --- .gitignore | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index c78b21b50..7dd14fd83 100644 --- a/.gitignore +++ b/.gitignore @@ -11,22 +11,4 @@ tex2pdf* .coverage .idea .vscode -03_picnic/picnic.py -04_jump_the_five/jump.py -05_howler/howler.py -06_wc/wc.py -07_gashlycrumb/gashlycrumb.py -08_apples_and_bananas/apples.py -09_abuse/abuse.py -10_telephone/telephone.py -11_bottles_of_beer/bottles.py -12_ransom/ransom.py -13_twelve_days/twelve_days.py -14_rhymer/rhymer.py -15_kentucky_friar/friar.py -16_scrambler/scrambler.py -17_mad_libs/mad.py -18_gematria/gematria.py -19_wod/wod.py -20_password/password.py -21_tictactoe/tictactoe.py + From cbc7eae36d1f011b4c15516dffc1c6d5790dfaa1 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 16:03:18 -0800 Subject: [PATCH 13/63] Add expected output --- 02_crowsnest/crowsnest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/02_crowsnest/crowsnest.py b/02_crowsnest/crowsnest.py index 8a2c8d4b1..a009a2422 100644 --- a/02_crowsnest/crowsnest.py +++ b/02_crowsnest/crowsnest.py @@ -28,8 +28,9 @@ def main(): """Make a jazz noise here""" args = get_args() - pos_arg = args.positional - print(f'positional = "{pos_arg}"') + + output_message = 'Ahoy, Captain, a '+ args.positional +' off the larboard bow!' + print(output_message) # -------------------------------------------------- From 9f52b2f28bf4febdafa1ac2c830506110fc37d47 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 16:09:45 -0800 Subject: [PATCH 14/63] Add doc --- README_fleide.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README_fleide.md b/README_fleide.md index c59b80241..f49c8d484 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -70,4 +70,22 @@ args = parser.parse_args() flake 8 hello.py pylint hello.py +``` + + +## Chapter 2 - Working with strings + +### Getting part of a string + +```Python + +help(str) + +word[n] # from left, 1 char starting at 0 +word[-n] # from right, 1 char starting at -1 + +word[n:p] # substring() +word[:p] # left() +word[n:] # right() + ``` \ No newline at end of file From cfd1fad3f1c35575f5769ae128e77188494b1b7f Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 3 Dec 2020 16:18:29 -0800 Subject: [PATCH 15/63] Pass test --- 02_crowsnest/crowsnest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/02_crowsnest/crowsnest.py b/02_crowsnest/crowsnest.py index a009a2422..6cb1d42ed 100644 --- a/02_crowsnest/crowsnest.py +++ b/02_crowsnest/crowsnest.py @@ -16,7 +16,7 @@ def get_args(): description='Look out matey!', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', #name of the parameter in the program + parser.add_argument('word', #name of the parameter in the program metavar='mob', #name of the parameter for the caller help='A mobile object ahead') @@ -28,8 +28,14 @@ def main(): """Make a jazz noise here""" args = get_args() + word = args.word + + # Is the first letter a vowel? + first_letter = word[0].lower() + article = 'an' if first_letter in 'aeiou' else 'a' + + output_message = f'Ahoy, Captain, {article} {word} off the larboard bow!' - output_message = 'Ahoy, Captain, a '+ args.positional +' off the larboard bow!' print(output_message) From 78b2068b68ca3c63c20d4fd2f28f99c8df715a5d Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:14:39 -0800 Subject: [PATCH 16/63] Bring back 03 --- {00_TODO/03_picnic => 03_picnic}/Makefile | 0 {00_TODO/03_picnic => 03_picnic}/README.md | 0 {00_TODO/03_picnic => 03_picnic}/all_test.sh | 0 {00_TODO/03_picnic => 03_picnic}/solution.py | 0 {00_TODO/03_picnic => 03_picnic}/test.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {00_TODO/03_picnic => 03_picnic}/Makefile (100%) rename {00_TODO/03_picnic => 03_picnic}/README.md (100%) rename {00_TODO/03_picnic => 03_picnic}/all_test.sh (100%) rename {00_TODO/03_picnic => 03_picnic}/solution.py (100%) rename {00_TODO/03_picnic => 03_picnic}/test.py (100%) diff --git a/00_TODO/03_picnic/Makefile b/03_picnic/Makefile similarity index 100% rename from 00_TODO/03_picnic/Makefile rename to 03_picnic/Makefile diff --git a/00_TODO/03_picnic/README.md b/03_picnic/README.md similarity index 100% rename from 00_TODO/03_picnic/README.md rename to 03_picnic/README.md diff --git a/00_TODO/03_picnic/all_test.sh b/03_picnic/all_test.sh similarity index 100% rename from 00_TODO/03_picnic/all_test.sh rename to 03_picnic/all_test.sh diff --git a/00_TODO/03_picnic/solution.py b/03_picnic/solution.py similarity index 100% rename from 00_TODO/03_picnic/solution.py rename to 03_picnic/solution.py diff --git a/00_TODO/03_picnic/test.py b/03_picnic/test.py similarity index 100% rename from 00_TODO/03_picnic/test.py rename to 03_picnic/test.py From 4da302cd2810ce4cb03561f7a8b2441b285848c2 Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:17:59 -0800 Subject: [PATCH 17/63] Create from template --- 03_picnic/picnic.py | 72 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 03_picnic/picnic.py diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py new file mode 100644 index 000000000..9509edf58 --- /dev/null +++ b/03_picnic/picnic.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2020-12-04 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() From 267a4a6c5b07bbb534b2ad19774b7bf8aab14efe Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:48:54 -0800 Subject: [PATCH 18/63] Add list info --- README_fleide.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README_fleide.md b/README_fleide.md index f49c8d484..7fb5f97f0 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -84,8 +84,41 @@ help(str) word[n] # from left, 1 char starting at 0 word[-n] # from right, 1 char starting at -1 +# slicing a string as a list of strings + word[n:p] # substring() word[:p] # left() word[n:] # right() -``` \ No newline at end of file +``` + +## Chapter 3 - Working with lists + +``` Python + +items = list() +len(items) + +items.append('b') +items.append(['c','d']) # ['b', ['c', 'd']] +items.extend(['c','d']) # ['b', 'c', 'd'] + +items.insert(0, 'a') +items.index('chips') # returns 0, unsafe - check if there before + # slicing applies, and is safe + +items.pop() # removes index -1 (last) +items.pop(0) # a + +items.remove('b') # removes the first occurence, unsafe - check if there before + +items.sort() # in-place +items.sort(reverse=True) +items.reverse() #in-place +sorted(items) # returns a new sorted list +reversed(items) #returns a new reversed list, lazy, needs to be invoked via list(...) + +items_joined = ', '.join(items) # output a single list with separator + + +``` From 2ead0459c061191a8f3445a6e35fb665be0f4a18 Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:51:08 -0800 Subject: [PATCH 19/63] Pass test_one --- 03_picnic/picnic.py | 52 ++++++++++++--------------------------------- README_fleide.md | 2 +- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 9509edf58..470790cb0 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -2,7 +2,7 @@ """ Author : fleide Date : 2020-12-04 -Purpose: Rock the Casbah +Purpose: Picnic """ import argparse @@ -16,35 +16,15 @@ def get_args(): description='Rock the Casbah', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') + parser.add_argument('foods', + metavar='foods', + nargs='+', # we can take more than one + help='Item(s) to bring') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), - default=None) - - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + parser.add_argument('-s', + '--sorted', + help='Sort the items (default: False)', + action='store_true') # magic! return parser.parse_args() @@ -54,17 +34,11 @@ def main(): """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional + sorted = args.sorted + foods = args.foods - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + output_foods = ', '.join(foods) + print(f'You are bringing {output_foods}.') # -------------------------------------------------- diff --git a/README_fleide.md b/README_fleide.md index 7fb5f97f0..fcdc9395a 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -118,7 +118,7 @@ items.reverse() #in-place sorted(items) # returns a new sorted list reversed(items) #returns a new reversed list, lazy, needs to be invoked via list(...) -items_joined = ', '.join(items) # output a single list with separator +items_joined = ', '.join(items) # output a single string with separator ``` From 7a21ac5b0573ac771063a4352f56c2a236adf81c Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:55:51 -0800 Subject: [PATCH 20/63] Pass test_two --- 03_picnic/picnic.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 470790cb0..1b42b85e1 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -37,8 +37,13 @@ def main(): sorted = args.sorted foods = args.foods - output_foods = ', '.join(foods) - print(f'You are bringing {output_foods}.') + if (len(foods) == 1): + print(f'You are bringing {foods[0]}.') + elif (len(foods) == 2): + print(f'You are bringing {foods[0]} and {foods[1]}.') + else: + out = ', '.join(foods) + print(f'You are bringing {out}.') # -------------------------------------------------- From c067756618f551ca7c0a4fb42a071e0951cfb039 Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 15:58:08 -0800 Subject: [PATCH 21/63] Pass test_more_than_two --- 03_picnic/picnic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 1b42b85e1..340a90547 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -42,8 +42,9 @@ def main(): elif (len(foods) == 2): print(f'You are bringing {foods[0]} and {foods[1]}.') else: - out = ', '.join(foods) - print(f'You are bringing {out}.') + last_food = foods.pop(-1) + comma_sep_list = ', '.join(foods) + print(f'You are bringing {comma_sep_list}, and {last_food}.') # -------------------------------------------------- From e9f27f2fcc8bd4769a2a496589c70c79160c18e5 Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 16:00:05 -0800 Subject: [PATCH 22/63] Pass test_two_sorted --- 03_picnic/picnic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 340a90547..10ad258ec 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -40,6 +40,7 @@ def main(): if (len(foods) == 1): print(f'You are bringing {foods[0]}.') elif (len(foods) == 2): + if sorted: foods.sort() print(f'You are bringing {foods[0]} and {foods[1]}.') else: last_food = foods.pop(-1) From 01709e150b526a58a2477569237bc68fb0cceb61 Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 16:00:58 -0800 Subject: [PATCH 23/63] Pass test_more_than_two_sorted --- 03_picnic/picnic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 10ad258ec..42a4e02b6 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -37,10 +37,11 @@ def main(): sorted = args.sorted foods = args.foods + if sorted: foods.sort() + if (len(foods) == 1): print(f'You are bringing {foods[0]}.') elif (len(foods) == 2): - if sorted: foods.sort() print(f'You are bringing {foods[0]} and {foods[1]}.') else: last_food = foods.pop(-1) From ad47b99d566b5f56d3c303d9166d56efeec0129e Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 4 Dec 2020 16:05:35 -0800 Subject: [PATCH 24/63] Clean code --- 03_picnic/picnic.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/03_picnic/picnic.py b/03_picnic/picnic.py index 42a4e02b6..65d1a2e1c 100644 --- a/03_picnic/picnic.py +++ b/03_picnic/picnic.py @@ -37,17 +37,19 @@ def main(): sorted = args.sorted foods = args.foods - if sorted: foods.sort() + if sorted: + foods.sort() + bringing = '' if (len(foods) == 1): - print(f'You are bringing {foods[0]}.') + bringing = foods[0] elif (len(foods) == 2): - print(f'You are bringing {foods[0]} and {foods[1]}.') + bringing = f'{foods[0]} and {foods[1]}' else: last_food = foods.pop(-1) - comma_sep_list = ', '.join(foods) - print(f'You are bringing {comma_sep_list}, and {last_food}.') + bringing = ', '.join(foods) + f', and {last_food}' + print(f'You are bringing {bringing}.') # -------------------------------------------------- if __name__ == '__main__': From 8db9beb68dddf6f23c5d203f3ed6572da528ed8d Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:08:26 -0800 Subject: [PATCH 25/63] Add meta help --- README_fleide.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README_fleide.md b/README_fleide.md index fcdc9395a..51b5c7961 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -1,5 +1,12 @@ # Tiny Python Projects +## Meta + +Terminal displays: +- Top, **run** +- Bottom left (alt shift -), **test** : `pytest -v -x test.py` +- Bottom right (alt shift =), **git** : `git add.` `git commit -m ...`, `git push origin master` + ## Chapter 0 - Installation First pip was missing so: From 67132f797e5ec447b7410b1fbc317960ae626225 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:10:25 -0800 Subject: [PATCH 26/63] Move 04 --- {00_TODO/04_jump_the_five => 04_jump_the_five}/Makefile | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/README.md | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/all_test.sh | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/solution1.py | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/solution2.py | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/solution3.py | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/solution4.py | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/solution5.py | 0 {00_TODO/04_jump_the_five => 04_jump_the_five}/test.py | 0 README_fleide.md | 2 +- 10 files changed, 1 insertion(+), 1 deletion(-) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/Makefile (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/README.md (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/all_test.sh (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/solution1.py (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/solution2.py (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/solution3.py (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/solution4.py (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/solution5.py (100%) rename {00_TODO/04_jump_the_five => 04_jump_the_five}/test.py (100%) diff --git a/00_TODO/04_jump_the_five/Makefile b/04_jump_the_five/Makefile similarity index 100% rename from 00_TODO/04_jump_the_five/Makefile rename to 04_jump_the_five/Makefile diff --git a/00_TODO/04_jump_the_five/README.md b/04_jump_the_five/README.md similarity index 100% rename from 00_TODO/04_jump_the_five/README.md rename to 04_jump_the_five/README.md diff --git a/00_TODO/04_jump_the_five/all_test.sh b/04_jump_the_five/all_test.sh similarity index 100% rename from 00_TODO/04_jump_the_five/all_test.sh rename to 04_jump_the_five/all_test.sh diff --git a/00_TODO/04_jump_the_five/solution1.py b/04_jump_the_five/solution1.py similarity index 100% rename from 00_TODO/04_jump_the_five/solution1.py rename to 04_jump_the_five/solution1.py diff --git a/00_TODO/04_jump_the_five/solution2.py b/04_jump_the_five/solution2.py similarity index 100% rename from 00_TODO/04_jump_the_five/solution2.py rename to 04_jump_the_five/solution2.py diff --git a/00_TODO/04_jump_the_five/solution3.py b/04_jump_the_five/solution3.py similarity index 100% rename from 00_TODO/04_jump_the_five/solution3.py rename to 04_jump_the_five/solution3.py diff --git a/00_TODO/04_jump_the_five/solution4.py b/04_jump_the_five/solution4.py similarity index 100% rename from 00_TODO/04_jump_the_five/solution4.py rename to 04_jump_the_five/solution4.py diff --git a/00_TODO/04_jump_the_five/solution5.py b/04_jump_the_five/solution5.py similarity index 100% rename from 00_TODO/04_jump_the_five/solution5.py rename to 04_jump_the_five/solution5.py diff --git a/00_TODO/04_jump_the_five/test.py b/04_jump_the_five/test.py similarity index 100% rename from 00_TODO/04_jump_the_five/test.py rename to 04_jump_the_five/test.py diff --git a/README_fleide.md b/README_fleide.md index 51b5c7961..329e506c0 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -3,7 +3,7 @@ ## Meta Terminal displays: -- Top, **run** +- Top, **run** : - Bottom left (alt shift -), **test** : `pytest -v -x test.py` - Bottom right (alt shift =), **git** : `git add.` `git commit -m ...`, `git push origin master` From 765af43ba0bc3e28bcce4a395f4db6951c1b55e5 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:30:41 -0800 Subject: [PATCH 27/63] Add chapter 04 dict notes --- README_fleide.md | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/README_fleide.md b/README_fleide.md index 329e506c0..d4754f28e 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -61,7 +61,7 @@ Nice to have: Using `argparse` -```Python +```PYTHON import argparse parser = argparse.ArgumentParser(description='Say Hello') @@ -84,7 +84,7 @@ pylint hello.py ### Getting part of a string -```Python +```PYTHON help(str) @@ -101,7 +101,7 @@ word[n:] # right() ## Chapter 3 - Working with lists -``` Python +```PYTHON items = list() len(items) @@ -129,3 +129,38 @@ items_joined = ', '.join(items) # output a single string with separator ``` + +## Chapter 4 - Working with dictionaries + +```PYTHON + +answers = dict() +answers = {} + +answers = dict(name='Lancelot',quest='Holy Grail') +answers= {'name': 'Lancelot', 'quest': 'Holy Grail'} + +answers['name'] +answers['age'] # => exception +'age' in answers # => false +answers.get('age') # => nothing +answers.get('age',30) # => 30 + +len(answers) +answers.keys() +answers.values() + +for key in answers.keys(): + print(key, answers[key]) + +#or + +answers.items() +for key, value in answers.items(): + print(key, value) + +dict.pop() +dict.update() +#etc + +``` \ No newline at end of file From df2ba716041954a9b9b38e20e61b8c8e586fd373 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:33:19 -0800 Subject: [PATCH 28/63] Add template file --- 04_jump_the_five/jump.py | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 04_jump_the_five/jump.py diff --git a/04_jump_the_five/jump.py b/04_jump_the_five/jump.py new file mode 100644 index 000000000..0b72a684c --- /dev/null +++ b/04_jump_the_five/jump.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-01-20 +Purpose: Learning about dictionaries +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() From 481602471b8b6a209eed120eb14e9050fe242224 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:36:14 -0800 Subject: [PATCH 29/63] Pass test_usage --- 04_jump_the_five/jump.py | 41 +++------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/04_jump_the_five/jump.py b/04_jump_the_five/jump.py index 0b72a684c..1eefa5a4e 100644 --- a/04_jump_the_five/jump.py +++ b/04_jump_the_five/jump.py @@ -13,57 +13,22 @@ def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Jumping into dicts', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', + parser.add_argument('str', metavar='str', help='A positional argument') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), - default=None) - - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') - return parser.parse_args() # -------------------------------------------------- def main(): - """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional + pos_arg = args.str - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') print(f'positional = "{pos_arg}"') From 121f05b3cbe92e61e8deb760a3f3ea62f31befc9 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:47:23 -0800 Subject: [PATCH 30/63] Pass test_01 and 02 --- 04_jump_the_five/jump.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/04_jump_the_five/jump.py b/04_jump_the_five/jump.py index 1eefa5a4e..f7353d6e7 100644 --- a/04_jump_the_five/jump.py +++ b/04_jump_the_five/jump.py @@ -29,7 +29,12 @@ def main(): args = get_args() pos_arg = args.str - print(f'positional = "{pos_arg}"') + jumper = {'1': '9','2': '8','2': '8','3': '7','4': '6','5': '0','6': '4','7': '3','8': '2','9': '1','0': '5'} + new_text = '' + + for char in pos_arg: + new_text +=jumper.get(char, char) + print(new_text) # -------------------------------------------------- From a0f195edff4e0a600a926c08da71c135a6ea160f Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:52:25 -0800 Subject: [PATCH 31/63] Add alternatives --- 04_jump_the_five/jump.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/04_jump_the_five/jump.py b/04_jump_the_five/jump.py index f7353d6e7..1e45e8573 100644 --- a/04_jump_the_five/jump.py +++ b/04_jump_the_five/jump.py @@ -36,6 +36,12 @@ def main(): new_text +=jumper.get(char, char) print(new_text) + # also nice : list comprehension + new_text2 = ''.join([jumper.get(char,char) for char in pos_arg]) + # also nice : str method + new_text3 = pos_arg.translate(str.maketrans(jumper)) + + # -------------------------------------------------- if __name__ == '__main__': From 7863cfd04a4b27f58c6795da83d0af67801009f6 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 20 Jan 2021 15:53:19 -0800 Subject: [PATCH 32/63] Add comment --- README_fleide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fleide.md b/README_fleide.md index d4754f28e..d9e2988c7 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -4,7 +4,7 @@ Terminal displays: - Top, **run** : -- Bottom left (alt shift -), **test** : `pytest -v -x test.py` +- Bottom left (alt shift -), **test** : `pytest -v -x test.py` or `make` if there's a Makefile - Bottom right (alt shift =), **git** : `git add.` `git commit -m ...`, `git push origin master` ## Chapter 0 - Installation From 9921cdade123a315c5a31df0cf5931f2887284fc Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 21 Jan 2021 11:18:30 -0800 Subject: [PATCH 33/63] Restore files for chapter 05 --- {00_TODO/05_howler => 05_howler}/.gitignore | 0 {00_TODO/05_howler => 05_howler}/Makefile | 0 {00_TODO/05_howler => 05_howler}/README.md | 0 {00_TODO/05_howler => 05_howler}/all_test.sh | 0 {00_TODO/05_howler => 05_howler}/mk-test-out.sh | 0 {00_TODO/05_howler => 05_howler}/solution1.py | 0 {00_TODO/05_howler => 05_howler}/solution2.py | 0 {00_TODO/05_howler => 05_howler}/test-outs/preamble.txt | 0 {00_TODO/05_howler => 05_howler}/test-outs/sonnet-29.txt | 0 {00_TODO/05_howler => 05_howler}/test-outs/the-bustle.txt | 0 {00_TODO/05_howler => 05_howler}/test.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename {00_TODO/05_howler => 05_howler}/.gitignore (100%) rename {00_TODO/05_howler => 05_howler}/Makefile (100%) rename {00_TODO/05_howler => 05_howler}/README.md (100%) rename {00_TODO/05_howler => 05_howler}/all_test.sh (100%) rename {00_TODO/05_howler => 05_howler}/mk-test-out.sh (100%) rename {00_TODO/05_howler => 05_howler}/solution1.py (100%) rename {00_TODO/05_howler => 05_howler}/solution2.py (100%) rename {00_TODO/05_howler => 05_howler}/test-outs/preamble.txt (100%) rename {00_TODO/05_howler => 05_howler}/test-outs/sonnet-29.txt (100%) rename {00_TODO/05_howler => 05_howler}/test-outs/the-bustle.txt (100%) rename {00_TODO/05_howler => 05_howler}/test.py (100%) diff --git a/00_TODO/05_howler/.gitignore b/05_howler/.gitignore similarity index 100% rename from 00_TODO/05_howler/.gitignore rename to 05_howler/.gitignore diff --git a/00_TODO/05_howler/Makefile b/05_howler/Makefile similarity index 100% rename from 00_TODO/05_howler/Makefile rename to 05_howler/Makefile diff --git a/00_TODO/05_howler/README.md b/05_howler/README.md similarity index 100% rename from 00_TODO/05_howler/README.md rename to 05_howler/README.md diff --git a/00_TODO/05_howler/all_test.sh b/05_howler/all_test.sh similarity index 100% rename from 00_TODO/05_howler/all_test.sh rename to 05_howler/all_test.sh diff --git a/00_TODO/05_howler/mk-test-out.sh b/05_howler/mk-test-out.sh similarity index 100% rename from 00_TODO/05_howler/mk-test-out.sh rename to 05_howler/mk-test-out.sh diff --git a/00_TODO/05_howler/solution1.py b/05_howler/solution1.py similarity index 100% rename from 00_TODO/05_howler/solution1.py rename to 05_howler/solution1.py diff --git a/00_TODO/05_howler/solution2.py b/05_howler/solution2.py similarity index 100% rename from 00_TODO/05_howler/solution2.py rename to 05_howler/solution2.py diff --git a/00_TODO/05_howler/test-outs/preamble.txt b/05_howler/test-outs/preamble.txt similarity index 100% rename from 00_TODO/05_howler/test-outs/preamble.txt rename to 05_howler/test-outs/preamble.txt diff --git a/00_TODO/05_howler/test-outs/sonnet-29.txt b/05_howler/test-outs/sonnet-29.txt similarity index 100% rename from 00_TODO/05_howler/test-outs/sonnet-29.txt rename to 05_howler/test-outs/sonnet-29.txt diff --git a/00_TODO/05_howler/test-outs/the-bustle.txt b/05_howler/test-outs/the-bustle.txt similarity index 100% rename from 00_TODO/05_howler/test-outs/the-bustle.txt rename to 05_howler/test-outs/the-bustle.txt diff --git a/00_TODO/05_howler/test.py b/05_howler/test.py similarity index 100% rename from 00_TODO/05_howler/test.py rename to 05_howler/test.py From 466d8cb52bca2699715f97fa8ef4ca37ee2853c4 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 21 Jan 2021 11:20:07 -0800 Subject: [PATCH 34/63] Add template file --- 05_howler/howler.py | 72 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 05_howler/howler.py diff --git a/05_howler/howler.py b/05_howler/howler.py new file mode 100644 index 000000000..0f0c77ec8 --- /dev/null +++ b/05_howler/howler.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-01-21 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() From e81a75acc271db6870c3c7fc72bd50867ef499bb Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 21 Jan 2021 11:40:52 -0800 Subject: [PATCH 35/63] Pass test stdout --- 05_howler/howler.py | 47 +++++++++++++++------------------------------ README_fleide.md | 19 ++++++++++++++++++ 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/05_howler/howler.py b/05_howler/howler.py index 0f0c77ec8..714dfe170 100644 --- a/05_howler/howler.py +++ b/05_howler/howler.py @@ -2,45 +2,24 @@ """ Author : fleide Date : 2021-01-21 -Purpose: Rock the Casbah +Purpose: 05 - Howler """ import argparse - +import os # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Howler howling', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('positional', metavar='str', help='A positional argument') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), - default=None) - parser.add_argument('-o', '--on', help='A boolean flag', @@ -54,17 +33,21 @@ def main(): """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file flag_arg = args.on pos_arg = args.positional - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + str = '' + + if flag_arg: + if os.path.isfile(pos_arg): + str = open(pos_arg).read().rstrip().upper() + else: + #ERROR PATH + print('This is not working') + else: + str = pos_arg.upper() + + print(str) # -------------------------------------------------- diff --git a/README_fleide.md b/README_fleide.md index d9e2988c7..c3b15aa53 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -163,4 +163,23 @@ dict.pop() dict.update() #etc +``` + +## Chapter 5 - Working with files and STDOUT + +```PYTHON + +import os +os.path.isfile('haha.csv') +os.path.dirname(file) +os.path.basename(file) + +os.getcwd() # Current directory + +file_handler = open(file) +file_handler.read() # Empties the file handler +file_handler.seek(0) # To return to start and be able to read again + +str = open(file).read().rstrip() # Better (plus option to trim right) + ``` \ No newline at end of file From 98cb4a5e295afa6416f9f9a6d0dc94f0c3d47ad0 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 21 Jan 2021 15:00:13 -0800 Subject: [PATCH 36/63] Pass all tests --- 05_howler/FOX.txt | 1 + 05_howler/howler.py | 25 ++++++++++++++----------- README_fleide.md | 11 +++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 05_howler/FOX.txt diff --git a/05_howler/FOX.txt b/05_howler/FOX.txt new file mode 100644 index 000000000..fa96e1af2 --- /dev/null +++ b/05_howler/FOX.txt @@ -0,0 +1 @@ +THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. diff --git a/05_howler/howler.py b/05_howler/howler.py index 714dfe170..dc2ab66a4 100644 --- a/05_howler/howler.py +++ b/05_howler/howler.py @@ -21,9 +21,11 @@ def get_args(): help='A positional argument') parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + '--outfile', + help='Output filename', + metavar='str', + type=str, + default='') return parser.parse_args() @@ -33,21 +35,22 @@ def main(): """Make a jazz noise here""" args = get_args() - flag_arg = args.on + out_arg = args.outfile pos_arg = args.positional str = '' - if flag_arg: - if os.path.isfile(pos_arg): - str = open(pos_arg).read().rstrip().upper() - else: - #ERROR PATH - print('This is not working') + if os.path.isfile(pos_arg): + str = open(pos_arg).read().rstrip().upper() else: str = pos_arg.upper() - print(str) + if out_arg: + out_fh = open(out_arg,'wt') + print(str, file=out_fh) + out_fh.close() + else: + print(str) # -------------------------------------------------- diff --git a/README_fleide.md b/README_fleide.md index c3b15aa53..ebc37d1a7 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -176,10 +176,21 @@ os.path.basename(file) os.getcwd() # Current directory +# Reading + file_handler = open(file) file_handler.read() # Empties the file handler file_handler.seek(0) # To return to start and be able to read again str = open(file).read().rstrip() # Better (plus option to trim right) +# Writing + +out_fh = open('new.txt','wt') # Modes : r/w/append, and text/bytes + +out_fh.write('Some text plus a return feed because else its missing \n') +print('or via print and then no need for the return', file=out_fh) + +out_fh.close() + ``` \ No newline at end of file From 71a4ad5986d5425782cd98e41cb9194e3fd73a5d Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 25 Jan 2021 09:44:09 -0800 Subject: [PATCH 37/63] Finish doc chapter 5 --- README_fleide.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README_fleide.md b/README_fleide.md index ebc37d1a7..bb2cc3c7b 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -182,15 +182,32 @@ file_handler = open(file) file_handler.read() # Empties the file handler file_handler.seek(0) # To return to start and be able to read again -str = open(file).read().rstrip() # Better (plus option to trim right) +if os.path.isfile(file): + str = open(file).read().rstrip() # Better (plus option to trim right) # Writing out_fh = open('new.txt','wt') # Modes : r/w/append, and text/bytes +# NB : sys.stdout is a file handler! +out_fh = open('new.txt','wt') if flag else sys.stdout + out_fh.write('Some text plus a return feed because else its missing \n') print('or via print and then no need for the return', file=out_fh) out_fh.close() +# Reading large files + +if os.path.isfile(file): + text = open(file) # Open but not read + +for line in text: + str = line.upper() + +#also +import io +text = io.StringIO(filepath) + + ``` \ No newline at end of file From 33841125dc1de6b29a77db4b5527107ffd9dbd43 Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 25 Jan 2021 15:19:23 -0800 Subject: [PATCH 38/63] Prep for chapter 06 --- {00_TODO/06_wc => 06_wc}/Makefile | 0 {00_TODO/06_wc => 06_wc}/README.md | 0 {00_TODO/06_wc => 06_wc}/all_test.sh | 0 {00_TODO/06_wc => 06_wc}/inputs/empty.txt | 0 {00_TODO/06_wc => 06_wc}/inputs/foo.txt | 0 {00_TODO/06_wc => 06_wc}/inputs/one.txt | 0 {00_TODO/06_wc => 06_wc}/inputs/two.txt | 0 {00_TODO/06_wc => 06_wc}/solution.py | 0 {00_TODO/06_wc => 06_wc}/test.py | 0 06_wc/wc.py | 72 +++++++++++++++++++++++ README_fleide.md | 6 ++ 11 files changed, 78 insertions(+) rename {00_TODO/06_wc => 06_wc}/Makefile (100%) rename {00_TODO/06_wc => 06_wc}/README.md (100%) rename {00_TODO/06_wc => 06_wc}/all_test.sh (100%) rename {00_TODO/06_wc => 06_wc}/inputs/empty.txt (100%) rename {00_TODO/06_wc => 06_wc}/inputs/foo.txt (100%) rename {00_TODO/06_wc => 06_wc}/inputs/one.txt (100%) rename {00_TODO/06_wc => 06_wc}/inputs/two.txt (100%) rename {00_TODO/06_wc => 06_wc}/solution.py (100%) rename {00_TODO/06_wc => 06_wc}/test.py (100%) create mode 100644 06_wc/wc.py diff --git a/00_TODO/06_wc/Makefile b/06_wc/Makefile similarity index 100% rename from 00_TODO/06_wc/Makefile rename to 06_wc/Makefile diff --git a/00_TODO/06_wc/README.md b/06_wc/README.md similarity index 100% rename from 00_TODO/06_wc/README.md rename to 06_wc/README.md diff --git a/00_TODO/06_wc/all_test.sh b/06_wc/all_test.sh similarity index 100% rename from 00_TODO/06_wc/all_test.sh rename to 06_wc/all_test.sh diff --git a/00_TODO/06_wc/inputs/empty.txt b/06_wc/inputs/empty.txt similarity index 100% rename from 00_TODO/06_wc/inputs/empty.txt rename to 06_wc/inputs/empty.txt diff --git a/00_TODO/06_wc/inputs/foo.txt b/06_wc/inputs/foo.txt similarity index 100% rename from 00_TODO/06_wc/inputs/foo.txt rename to 06_wc/inputs/foo.txt diff --git a/00_TODO/06_wc/inputs/one.txt b/06_wc/inputs/one.txt similarity index 100% rename from 00_TODO/06_wc/inputs/one.txt rename to 06_wc/inputs/one.txt diff --git a/00_TODO/06_wc/inputs/two.txt b/06_wc/inputs/two.txt similarity index 100% rename from 00_TODO/06_wc/inputs/two.txt rename to 06_wc/inputs/two.txt diff --git a/00_TODO/06_wc/solution.py b/06_wc/solution.py similarity index 100% rename from 00_TODO/06_wc/solution.py rename to 06_wc/solution.py diff --git a/00_TODO/06_wc/test.py b/06_wc/test.py similarity index 100% rename from 00_TODO/06_wc/test.py rename to 06_wc/test.py diff --git a/06_wc/wc.py b/06_wc/wc.py new file mode 100644 index 000000000..ddb012d05 --- /dev/null +++ b/06_wc/wc.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-01-25 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/README_fleide.md b/README_fleide.md index bb2cc3c7b..4e412fe27 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -210,4 +210,10 @@ import io text = io.StringIO(filepath) +``` + +## Chapter 6 - Reading files and STDIN + +```PYTHON + ``` \ No newline at end of file From f1a9eefb0a31bfad12aafaabf481147779fe83c0 Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 25 Jan 2021 15:49:19 -0800 Subject: [PATCH 39/63] Complete chapter 6 --- 06_wc/wc.py | 76 +++++++++++++++++++++--------------------------- README_fleide.md | 14 +++++++++ 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/06_wc/wc.py b/06_wc/wc.py index ddb012d05..c661e12bb 100644 --- a/06_wc/wc.py +++ b/06_wc/wc.py @@ -2,69 +2,59 @@ """ Author : fleide Date : 2021-01-25 -Purpose: Rock the Casbah +Purpose: Chapter 06 """ import argparse - +import sys # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Emulate wc (word count)', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') - - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', + parser.add_argument('file', + help='Input file(s)', metavar='FILE', type=argparse.FileType('rt'), - default=None) - - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + default=[sys.stdin], + nargs='*') # 0 or more - return parser.parse_args() + args = parser.parse_args() + return args # -------------------------------------------------- def main(): - """Make a jazz noise here""" + """Emulate wc (word count)e""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional - - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + + total_lines = 0 + total_words = 0 + total_bytes = 0 + + for fh in args.file: + num_lines = 0 + num_words = 0 + num_bytes = 0 + + for line in fh: + num_lines += 1 + num_words += len(line.split()) + num_bytes += len(line) + + total_lines += num_lines + total_words += num_words + total_bytes += num_bytes + + print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}') + + if len(args.file) > 1: + print(f'{total_lines:8}{total_words:8}{total_bytes:8} total') # -------------------------------------------------- diff --git a/README_fleide.md b/README_fleide.md index 4e412fe27..5540ce71d 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -216,4 +216,18 @@ text = io.StringIO(filepath) ```PYTHON +import argparse +import sys + +parser.add_argument('file', + help='Input file(s)', + metavar='FILE', + type=argparse.FileType('rt'), + default=[sys.stdin], # default to STDIN + nargs='*') # 0 or more + +#... + +print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}') + ``` \ No newline at end of file From 5a494bc95e55a18562122bd85449613837b52e83 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 27 Jan 2021 10:12:29 -0800 Subject: [PATCH 40/63] Prep chapter 7 --- .../Makefile | 0 .../README.md | 0 .../all_test.sh | 0 .../alternate.txt | 0 07_gashlycrumb/gashlycrumb.py | 72 +++++++++++++++++++ .../gashlycrumb.txt | 0 .../gashlycrumb_interactive.py | 0 .../solution1.py | 0 .../solution2_dict_comp.py | 0 .../solution3_dict_get.py | 0 .../07_gashlycrumb => 07_gashlycrumb}/test.py | 0 README_fleide.md | 10 ++- 12 files changed, 81 insertions(+), 1 deletion(-) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/Makefile (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/README.md (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/all_test.sh (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/alternate.txt (100%) create mode 100644 07_gashlycrumb/gashlycrumb.py rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/gashlycrumb.txt (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/gashlycrumb_interactive.py (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/solution1.py (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/solution2_dict_comp.py (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/solution3_dict_get.py (100%) rename {00_TODO/07_gashlycrumb => 07_gashlycrumb}/test.py (100%) diff --git a/00_TODO/07_gashlycrumb/Makefile b/07_gashlycrumb/Makefile similarity index 100% rename from 00_TODO/07_gashlycrumb/Makefile rename to 07_gashlycrumb/Makefile diff --git a/00_TODO/07_gashlycrumb/README.md b/07_gashlycrumb/README.md similarity index 100% rename from 00_TODO/07_gashlycrumb/README.md rename to 07_gashlycrumb/README.md diff --git a/00_TODO/07_gashlycrumb/all_test.sh b/07_gashlycrumb/all_test.sh similarity index 100% rename from 00_TODO/07_gashlycrumb/all_test.sh rename to 07_gashlycrumb/all_test.sh diff --git a/00_TODO/07_gashlycrumb/alternate.txt b/07_gashlycrumb/alternate.txt similarity index 100% rename from 00_TODO/07_gashlycrumb/alternate.txt rename to 07_gashlycrumb/alternate.txt diff --git a/07_gashlycrumb/gashlycrumb.py b/07_gashlycrumb/gashlycrumb.py new file mode 100644 index 000000000..927b94605 --- /dev/null +++ b/07_gashlycrumb/gashlycrumb.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-01-27 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/07_gashlycrumb/gashlycrumb.txt b/07_gashlycrumb/gashlycrumb.txt similarity index 100% rename from 00_TODO/07_gashlycrumb/gashlycrumb.txt rename to 07_gashlycrumb/gashlycrumb.txt diff --git a/00_TODO/07_gashlycrumb/gashlycrumb_interactive.py b/07_gashlycrumb/gashlycrumb_interactive.py similarity index 100% rename from 00_TODO/07_gashlycrumb/gashlycrumb_interactive.py rename to 07_gashlycrumb/gashlycrumb_interactive.py diff --git a/00_TODO/07_gashlycrumb/solution1.py b/07_gashlycrumb/solution1.py similarity index 100% rename from 00_TODO/07_gashlycrumb/solution1.py rename to 07_gashlycrumb/solution1.py diff --git a/00_TODO/07_gashlycrumb/solution2_dict_comp.py b/07_gashlycrumb/solution2_dict_comp.py similarity index 100% rename from 00_TODO/07_gashlycrumb/solution2_dict_comp.py rename to 07_gashlycrumb/solution2_dict_comp.py diff --git a/00_TODO/07_gashlycrumb/solution3_dict_get.py b/07_gashlycrumb/solution3_dict_get.py similarity index 100% rename from 00_TODO/07_gashlycrumb/solution3_dict_get.py rename to 07_gashlycrumb/solution3_dict_get.py diff --git a/00_TODO/07_gashlycrumb/test.py b/07_gashlycrumb/test.py similarity index 100% rename from 00_TODO/07_gashlycrumb/test.py rename to 07_gashlycrumb/test.py diff --git a/README_fleide.md b/README_fleide.md index 5540ce71d..c6fb530d5 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -230,4 +230,12 @@ parser.add_argument('file', print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}') -``` \ No newline at end of file +``` + +## Chapter 7 - Using a dictionary + +```PYTHON + + + +``` From ca05fd348890948db0bbeb2b09dc93b61f4bb3dd Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 27 Jan 2021 10:52:14 -0800 Subject: [PATCH 41/63] Pass tests 1 to 7 --- 07_gashlycrumb/gashlycrumb.py | 51 +++++++++++------------------------ README_fleide.md | 2 ++ 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/07_gashlycrumb/gashlycrumb.py b/07_gashlycrumb/gashlycrumb.py index 927b94605..75b8dd8c2 100644 --- a/07_gashlycrumb/gashlycrumb.py +++ b/07_gashlycrumb/gashlycrumb.py @@ -2,7 +2,7 @@ """ Author : fleide Date : 2021-01-27 -Purpose: Rock the Casbah +Purpose: Working with directories """ import argparse @@ -13,38 +13,21 @@ def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Gashly Crumbing', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') + parser.add_argument('letter', + metavar='letter', + nargs='+', # 1 or more + help='Letter(s)') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) parser.add_argument('-f', '--file', - help='A readable file', + help='A readable dictionary file', metavar='FILE', type=argparse.FileType('rt'), - default=None) - - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + default="gashlycrumb.txt") return parser.parse_args() @@ -54,18 +37,16 @@ def main(): """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional + letters = args.letter + dictionary_source = args.file + + dictionary = {} - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + for line in dictionary_source: + dictionary[line[0]] = line.rstrip() + for letter in letters: + print(dictionary.get(letter.upper(),letter+' is not found')) # -------------------------------------------------- if __name__ == '__main__': diff --git a/README_fleide.md b/README_fleide.md index c6fb530d5..cb06b5856 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -146,6 +146,8 @@ answers['age'] # => exception answers.get('age') # => nothing answers.get('age',30) # => 30 +answers['key'] = 'value' + len(answers) answers.keys() answers.values() From 94f19ea230ca647c6bc46cdc01bf6eec8cd7a752 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 27 Jan 2021 10:54:01 -0800 Subject: [PATCH 42/63] Pass all tests --- 07_gashlycrumb/gashlycrumb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/07_gashlycrumb/gashlycrumb.py b/07_gashlycrumb/gashlycrumb.py index 75b8dd8c2..7041996a7 100644 --- a/07_gashlycrumb/gashlycrumb.py +++ b/07_gashlycrumb/gashlycrumb.py @@ -34,7 +34,7 @@ def get_args(): # -------------------------------------------------- def main(): - """Make a jazz noise here""" + """Gashly Crumbing the Crumbs""" args = get_args() letters = args.letter @@ -46,7 +46,7 @@ def main(): dictionary[line[0]] = line.rstrip() for letter in letters: - print(dictionary.get(letter.upper(),letter+' is not found')) + print(dictionary.get(letter.upper(),'I do not know \"'+letter+'\".')) # -------------------------------------------------- if __name__ == '__main__': From 726548270318651268a1386f8a697e7bdee2bc83 Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 27 Jan 2021 11:03:06 -0800 Subject: [PATCH 43/63] Finalize --- 07_gashlycrumb/gashlycrumb.py | 2 +- README_fleide.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/07_gashlycrumb/gashlycrumb.py b/07_gashlycrumb/gashlycrumb.py index 7041996a7..131d958ea 100644 --- a/07_gashlycrumb/gashlycrumb.py +++ b/07_gashlycrumb/gashlycrumb.py @@ -43,7 +43,7 @@ def main(): dictionary = {} for line in dictionary_source: - dictionary[line[0]] = line.rstrip() + dictionary[line[0].upper()] = line.rstrip() for letter in letters: print(dictionary.get(letter.upper(),'I do not know \"'+letter+'\".')) diff --git a/README_fleide.md b/README_fleide.md index cb06b5856..b350ada06 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -238,6 +238,16 @@ print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}') ```PYTHON +dictionary = {} +for line in dictionary_source: + dictionary[line[0].upper()] = line.rstrip() + +#alt +lookup = { line[0].upper() : line.rstrip() for line in dictionary_source} + +#from module import function as alias +from pprint import pprint as pp +pp(dictionary) ``` From ae58203b8d984015cfae8ef3e8c325e594d3461a Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 27 Jan 2021 11:05:59 -0800 Subject: [PATCH 44/63] Prep chapter 8 --- .../Makefile | 0 .../README.md | 0 .../all_test.sh | 0 08_apples_and_bananas/apples.py | 72 +++++++++++++++++++ .../solution1_iterate_chars.py | 0 .../solution2_str_replace.py | 0 .../solution3_str_translate.py | 0 .../solution4_list_comprehension.py | 0 .../solution5.1_no_closure.py | 0 .../solution5_list_comp_function.py | 0 .../solution6_map_lambda.py | 0 .../solution7_map_function.py | 0 .../solution8_regex.py | 0 .../test.py | 0 README_fleide.md | 9 ++- 15 files changed, 79 insertions(+), 2 deletions(-) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/Makefile (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/README.md (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/all_test.sh (100%) create mode 100644 08_apples_and_bananas/apples.py rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution1_iterate_chars.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution2_str_replace.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution3_str_translate.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution4_list_comprehension.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution5.1_no_closure.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution5_list_comp_function.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution6_map_lambda.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution7_map_function.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/solution8_regex.py (100%) rename {00_TODO/08_apples_and_bananas => 08_apples_and_bananas}/test.py (100%) diff --git a/00_TODO/08_apples_and_bananas/Makefile b/08_apples_and_bananas/Makefile similarity index 100% rename from 00_TODO/08_apples_and_bananas/Makefile rename to 08_apples_and_bananas/Makefile diff --git a/00_TODO/08_apples_and_bananas/README.md b/08_apples_and_bananas/README.md similarity index 100% rename from 00_TODO/08_apples_and_bananas/README.md rename to 08_apples_and_bananas/README.md diff --git a/00_TODO/08_apples_and_bananas/all_test.sh b/08_apples_and_bananas/all_test.sh similarity index 100% rename from 00_TODO/08_apples_and_bananas/all_test.sh rename to 08_apples_and_bananas/all_test.sh diff --git a/08_apples_and_bananas/apples.py b/08_apples_and_bananas/apples.py new file mode 100644 index 000000000..927b94605 --- /dev/null +++ b/08_apples_and_bananas/apples.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-01-27 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/08_apples_and_bananas/solution1_iterate_chars.py b/08_apples_and_bananas/solution1_iterate_chars.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution1_iterate_chars.py rename to 08_apples_and_bananas/solution1_iterate_chars.py diff --git a/00_TODO/08_apples_and_bananas/solution2_str_replace.py b/08_apples_and_bananas/solution2_str_replace.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution2_str_replace.py rename to 08_apples_and_bananas/solution2_str_replace.py diff --git a/00_TODO/08_apples_and_bananas/solution3_str_translate.py b/08_apples_and_bananas/solution3_str_translate.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution3_str_translate.py rename to 08_apples_and_bananas/solution3_str_translate.py diff --git a/00_TODO/08_apples_and_bananas/solution4_list_comprehension.py b/08_apples_and_bananas/solution4_list_comprehension.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution4_list_comprehension.py rename to 08_apples_and_bananas/solution4_list_comprehension.py diff --git a/00_TODO/08_apples_and_bananas/solution5.1_no_closure.py b/08_apples_and_bananas/solution5.1_no_closure.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution5.1_no_closure.py rename to 08_apples_and_bananas/solution5.1_no_closure.py diff --git a/00_TODO/08_apples_and_bananas/solution5_list_comp_function.py b/08_apples_and_bananas/solution5_list_comp_function.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution5_list_comp_function.py rename to 08_apples_and_bananas/solution5_list_comp_function.py diff --git a/00_TODO/08_apples_and_bananas/solution6_map_lambda.py b/08_apples_and_bananas/solution6_map_lambda.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution6_map_lambda.py rename to 08_apples_and_bananas/solution6_map_lambda.py diff --git a/00_TODO/08_apples_and_bananas/solution7_map_function.py b/08_apples_and_bananas/solution7_map_function.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution7_map_function.py rename to 08_apples_and_bananas/solution7_map_function.py diff --git a/00_TODO/08_apples_and_bananas/solution8_regex.py b/08_apples_and_bananas/solution8_regex.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/solution8_regex.py rename to 08_apples_and_bananas/solution8_regex.py diff --git a/00_TODO/08_apples_and_bananas/test.py b/08_apples_and_bananas/test.py similarity index 100% rename from 00_TODO/08_apples_and_bananas/test.py rename to 08_apples_and_bananas/test.py diff --git a/README_fleide.md b/README_fleide.md index b350ada06..3aee9b197 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -82,8 +82,6 @@ pylint hello.py ## Chapter 2 - Working with strings -### Getting part of a string - ```PYTHON help(str) @@ -250,4 +248,11 @@ lookup = { line[0].upper() : line.rstrip() for line in dictionary_source} from pprint import pprint as pp pp(dictionary) +``` + +## Chapter 8 - Find and replace + +```PYTHON + + ``` From c53d8695841b175b4cc37de5d0c386dda5793e9e Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 1 Feb 2021 15:49:04 -0800 Subject: [PATCH 45/63] Prep for chapter 9 --- {00_TODO/09_abuse => 09_abuse}/Makefile | 0 {00_TODO/09_abuse => 09_abuse}/README.md | 0 09_abuse/abuse.py | 72 ++++++++++++++++++++++ {00_TODO/09_abuse => 09_abuse}/all_test.sh | 0 {00_TODO/09_abuse => 09_abuse}/solution.py | 0 {00_TODO/09_abuse => 09_abuse}/test.py | 0 6 files changed, 72 insertions(+) rename {00_TODO/09_abuse => 09_abuse}/Makefile (100%) rename {00_TODO/09_abuse => 09_abuse}/README.md (100%) create mode 100644 09_abuse/abuse.py rename {00_TODO/09_abuse => 09_abuse}/all_test.sh (100%) rename {00_TODO/09_abuse => 09_abuse}/solution.py (100%) rename {00_TODO/09_abuse => 09_abuse}/test.py (100%) diff --git a/00_TODO/09_abuse/Makefile b/09_abuse/Makefile similarity index 100% rename from 00_TODO/09_abuse/Makefile rename to 09_abuse/Makefile diff --git a/00_TODO/09_abuse/README.md b/09_abuse/README.md similarity index 100% rename from 00_TODO/09_abuse/README.md rename to 09_abuse/README.md diff --git a/09_abuse/abuse.py b/09_abuse/abuse.py new file mode 100644 index 000000000..caefc807f --- /dev/null +++ b/09_abuse/abuse.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-02-01 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/09_abuse/all_test.sh b/09_abuse/all_test.sh similarity index 100% rename from 00_TODO/09_abuse/all_test.sh rename to 09_abuse/all_test.sh diff --git a/00_TODO/09_abuse/solution.py b/09_abuse/solution.py similarity index 100% rename from 00_TODO/09_abuse/solution.py rename to 09_abuse/solution.py diff --git a/00_TODO/09_abuse/test.py b/09_abuse/test.py similarity index 100% rename from 00_TODO/09_abuse/test.py rename to 09_abuse/test.py From b1c40a2ab7f463d996ff7b8c5fa1f5710f7c4d4c Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 1 Feb 2021 16:14:07 -0800 Subject: [PATCH 46/63] Pass all tests --- 08_apples_and_bananas/apples.py | 66 +++++++++++++-------------------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/08_apples_and_bananas/apples.py b/08_apples_and_bananas/apples.py index 927b94605..82b908dcb 100644 --- a/08_apples_and_bananas/apples.py +++ b/08_apples_and_bananas/apples.py @@ -2,69 +2,55 @@ """ Author : fleide Date : 2021-01-27 -Purpose: Rock the Casbah +Purpose: Chapter 08 - Find and replace strings """ import argparse - +import os # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Apples and Bananas', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') - - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', + parser.add_argument('text', + metavar='text', type=str, - default='') + help='Input text or file') - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', - type=int, - default=0) + parser.add_argument('-v', + '--vowel', + help='The vowel to substitute, default (a)', + metavar='vowel', + type=str, + choices=['a','e','i','o','u'], + default='a') - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), - default=None) + args = parser.parse_args() - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + if os.path.isfile(args.text): + args.text = open(args.text).read().rstrip() - return parser.parse_args() + return args # -------------------------------------------------- def main(): - """Make a jazz noise here""" + """Find and replace strings""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional + text= args.text + v = args.vowel + + vowels=['a','e','i','o','u'] + for vowel in vowels: + text = text.replace(vowel,v) + text = text.replace(vowel.upper(),v.upper()) - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + print(text) # -------------------------------------------------- From fcbc233453b27e77cd9c92894627f60ccc2d52db Mon Sep 17 00:00:00 2001 From: fleid Date: Wed, 3 Feb 2021 11:51:51 -0800 Subject: [PATCH 47/63] Complete Chapter 8 --- README_fleide.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README_fleide.md b/README_fleide.md index 3aee9b197..770738a5b 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -254,5 +254,44 @@ pp(dictionary) ```PYTHON +# Using list comprehension + +squares = [num ** 2 for num in range(1,5)] + +new_text = [ + vowel if c in 'aeiou' else vowel.upper() if c in 'AEIOU' else c for c in text +] + +# Using list comprehension with a function + +def new_char(c): + return vowel if c in 'aeiou' else vowel.upper() if c in 'AEIOU' else c + +new_text = ''.join([new_char(c) for c in text]) + +# Using the map (lazy) function + +def new_char(c): + return vowel if c in 'aeiou' else vowel.upper() if c in 'AEIOU' else c + +new_text = ''.join(map(new_char,text)) + + +# Using the map (lazy) function with anonymous function (lambda) + +new_text = ''.join( + map ( + lambda c: vowel if c in 'aeiou' else vowel.upper() if c in 'AEIOU' else c + ,text + ) +) + +# Using Regex + +import re +pattern = '[aeiou]' +vowel = 'o' +new_text = re.sub(pattern, vowel, text) +new_text = re.sub(pattern.upper(), vowel.upper(), new_text) ``` From 7480a50523a0e4f3937be067f77feeb5aaf4f1db Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 4 Feb 2021 11:57:31 -0800 Subject: [PATCH 48/63] Pass tests 11 to 7 --- 09_abuse/abuse.py | 89 ++++++++++++++++++++++++++--------------------- README_fleide.md | 58 ++++++++++++++++++++++++++---- 2 files changed, 100 insertions(+), 47 deletions(-) diff --git a/09_abuse/abuse.py b/09_abuse/abuse.py index caefc807f..6ad7a87e8 100644 --- a/09_abuse/abuse.py +++ b/09_abuse/abuse.py @@ -2,70 +2,79 @@ """ Author : fleide Date : 2021-02-01 -Purpose: Rock the Casbah +Purpose: Chapter 09 """ import argparse - +import random # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Heap abuse', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', + '--adjectives', + help='Number of adjectives', + metavar='adjectives', + type=int, + default=2) + + parser.add_argument('-n', + '--number', + help='Number of insults', + metavar='insults', type=int, - default=0) + default=3) - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), + parser.add_argument('-s', + '--seed', + help='Random seed', + metavar='seed', + type=int, default=None) - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + args = parser.parse_args() + + if args.adjectives < 1: + parser.error(f'--adjectives "{args.adjectives}" must be > 0') + if args.number < 1: + parser.error(f'--number "{args.number}" must be > 0') return parser.parse_args() # -------------------------------------------------- def main(): - """Make a jazz noise here""" + """Generate random insults""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional - - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') - + random.seed(args.seed) + + source_adjectives = """ + bankrupt base caterwauling corrupt cullionly detestable dishonest false + filthsome filthy foolish foul gross heedless indistinguishable infected + insatiate irksome lascivious lecherous loathsome lubbery old peevish + rascaly rotten ruinous scurilous scurvy slanderous sodden-witted + thin-faced toad-spotted unmannered vile wall-eyed + """.strip().split() + + source_nouns = """ + Judas Satan ape ass barbermonger beggar block boy braggart butt + carbuncle coward coxcomb cur dandy degenerate fiend fishmonger fool + gull harpy jack jolthead knave liar lunatic maw milksop minion + ratcatcher recreant rogue scold slave swine traitor varlet villain worm + """.strip().split() + + insults = random.sample(source_nouns, args.number) + + for i in range(args.number): + adjectives = ', '.join(random.sample(source_adjectives,k=args.adjectives)) + insult = f'You {adjectives} {insults[i]}!' + print(insult) # -------------------------------------------------- if __name__ == '__main__': diff --git a/README_fleide.md b/README_fleide.md index 770738a5b..aa9e82834 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -80,7 +80,7 @@ pylint hello.py ``` -## Chapter 2 - Working with strings +## Chapter 2 - Strings ```PYTHON @@ -97,7 +97,7 @@ word[n:] # right() ``` -## Chapter 3 - Working with lists +## Chapter 3 - Lists ```PYTHON @@ -125,10 +125,18 @@ reversed(items) #returns a new reversed list, lazy, needs to be invoked items_joined = ', '.join(items) # output a single string with separator +# easier way to generate a list of individual static words +adjectives = """ +bankrupt base caterwauling corrupt cullionly detestable dishonest false +filthsome filthy foolish foul gross heedless indistinguishable infected +insatiate irksome lascivious lecherous loathsome lubbery old peevish +rascaly rotten ruinous scurilous scurvy slanderous sodden-witted +thin-faced toad-spotted unmannered vile wall-eyed +""".strip().split() ``` -## Chapter 4 - Working with dictionaries +## Chapter 4 - Dictionaries ```PYTHON @@ -165,7 +173,7 @@ dict.update() ``` -## Chapter 5 - Working with files and STDOUT +## Chapter 5 - Reading/writing files and STDOUT ```PYTHON @@ -212,7 +220,7 @@ text = io.StringIO(filepath) ``` -## Chapter 6 - Reading files and STDIN +## Chapter 6 - Reading files and STDIN, f'{}' ```PYTHON @@ -232,7 +240,7 @@ print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}') ``` -## Chapter 7 - Using a dictionary +## Chapter 7 - Parsing text via a dictionary ```PYTHON @@ -250,7 +258,7 @@ pp(dictionary) ``` -## Chapter 8 - Find and replace +## Chapter 8 - List comprehension, map, lambda ```PYTHON @@ -295,3 +303,39 @@ new_text = re.sub(pattern, vowel, text) new_text = re.sub(pattern.upper(), vowel.upper(), new_text) ``` + +## Chapter 9 - Random, Generating arg errors + +```PYTHON + +import random +random.seed(args.seed) + +adjectives = """ +bankrupt base caterwauling corrupt cullionly detestable dishonest false +filthsome filthy foolish foul gross heedless +""".strip().split() + +random.choice(adjectives) # single value +random.sample(adjectives,3) # multiple value, non repeating +random.choices(adjectives,3) # multiple value, repeating + +``` + +```PYTHON + + parser.add_argument('-n', + '--number', + help='Number of insults', + metavar='insults', + type=int, + default=3) + + args = parser.parse_args() + + if args.number < 1: + parser.error(f'--number "{args.number}" must be > 0') + + return parser.parse_args() + +``` From c007cc5c6e79bedecf70aec84b8a90ccbc31f388 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 4 Feb 2021 11:58:59 -0800 Subject: [PATCH 49/63] Pass all tests --- 09_abuse/abuse.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/09_abuse/abuse.py b/09_abuse/abuse.py index 6ad7a87e8..0fea13a66 100644 --- a/09_abuse/abuse.py +++ b/09_abuse/abuse.py @@ -69,11 +69,9 @@ def main(): ratcatcher recreant rogue scold slave swine traitor varlet villain worm """.strip().split() - insults = random.sample(source_nouns, args.number) - - for i in range(args.number): + for _ in range(args.number): adjectives = ', '.join(random.sample(source_adjectives,k=args.adjectives)) - insult = f'You {adjectives} {insults[i]}!' + insult = f'You {adjectives} {random.choice(source_nouns)}!' print(insult) # -------------------------------------------------- From b1f6966bac52226f34d2c217c3da1535228b6a30 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 4 Feb 2021 12:02:35 -0800 Subject: [PATCH 50/63] Doc update --- README_fleide.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/README_fleide.md b/README_fleide.md index aa9e82834..d2fa3bc46 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -304,7 +304,7 @@ new_text = re.sub(pattern.upper(), vowel.upper(), new_text) ``` -## Chapter 9 - Random, Generating arg errors +## Chapter 9 - Random, Generating arg errors, STDERR ```PYTHON @@ -324,18 +324,26 @@ random.choices(adjectives,3) # multiple value, repeating ```PYTHON - parser.add_argument('-n', - '--number', - help='Number of insults', - metavar='insults', - type=int, - default=3) +parser.add_argument('-n', + '--number', + help='Number of insults', + metavar='insults', + type=int, + default=3) - args = parser.parse_args() +args = parser.parse_args() - if args.number < 1: - parser.error(f'--number "{args.number}" must be > 0') +if args.number < 1: + parser.error(f'--number "{args.number}" must be > 0') - return parser.parse_args() +return parser.parse_args() ``` + +```PYTHON + +import sys +sys.exit() # returns 0 +sys.exit('Whatever') # returns 1 on STDERR/2 + +``` \ No newline at end of file From d84524526622df2bffd1b18d25c7be87e2158ffd Mon Sep 17 00:00:00 2001 From: fleid Date: Fri, 5 Feb 2021 10:45:57 -0800 Subject: [PATCH 51/63] Prep Chapter 10 --- .../10_telephone => 10_telephone}/Makefile | 0 .../10_telephone => 10_telephone}/README.md | 0 .../10_telephone => 10_telephone}/all_test.sh | 0 .../solution1.py | 0 .../solution2_list.py | 0 10_telephone/telephone.py | 72 +++++++++++++++++++ .../10_telephone => 10_telephone}/test.py | 0 7 files changed, 72 insertions(+) rename {00_TODO/10_telephone => 10_telephone}/Makefile (100%) rename {00_TODO/10_telephone => 10_telephone}/README.md (100%) rename {00_TODO/10_telephone => 10_telephone}/all_test.sh (100%) rename {00_TODO/10_telephone => 10_telephone}/solution1.py (100%) rename {00_TODO/10_telephone => 10_telephone}/solution2_list.py (100%) create mode 100644 10_telephone/telephone.py rename {00_TODO/10_telephone => 10_telephone}/test.py (100%) diff --git a/00_TODO/10_telephone/Makefile b/10_telephone/Makefile similarity index 100% rename from 00_TODO/10_telephone/Makefile rename to 10_telephone/Makefile diff --git a/00_TODO/10_telephone/README.md b/10_telephone/README.md similarity index 100% rename from 00_TODO/10_telephone/README.md rename to 10_telephone/README.md diff --git a/00_TODO/10_telephone/all_test.sh b/10_telephone/all_test.sh similarity index 100% rename from 00_TODO/10_telephone/all_test.sh rename to 10_telephone/all_test.sh diff --git a/00_TODO/10_telephone/solution1.py b/10_telephone/solution1.py similarity index 100% rename from 00_TODO/10_telephone/solution1.py rename to 10_telephone/solution1.py diff --git a/00_TODO/10_telephone/solution2_list.py b/10_telephone/solution2_list.py similarity index 100% rename from 00_TODO/10_telephone/solution2_list.py rename to 10_telephone/solution2_list.py diff --git a/10_telephone/telephone.py b/10_telephone/telephone.py new file mode 100644 index 000000000..6844c7b30 --- /dev/null +++ b/10_telephone/telephone.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-02-05 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/10_telephone/test.py b/10_telephone/test.py similarity index 100% rename from 00_TODO/10_telephone/test.py rename to 10_telephone/test.py From 2e76dea6aa43e43cbc274c94bdda3fc22e25a6a8 Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 8 Feb 2021 13:05:47 -0800 Subject: [PATCH 52/63] Add to the doc --- README_fleide.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README_fleide.md b/README_fleide.md index d2fa3bc46..26d441815 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -82,6 +82,8 @@ pylint hello.py ## Chapter 2 - Strings +Strings are immutable in Python. + ```PYTHON help(str) @@ -346,4 +348,10 @@ import sys sys.exit() # returns 0 sys.exit('Whatever') # returns 1 on STDERR/2 +``` + +## Chapter 10 - + +```PYTHON + ``` \ No newline at end of file From dc21df0a20ed58822e5dd03d4f7bd233c9be8a44 Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 8 Feb 2021 13:10:44 -0800 Subject: [PATCH 53/63] Add args --- 10_telephone/telephone.py | 47 +++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/10_telephone/telephone.py b/10_telephone/telephone.py index 6844c7b30..5e90e3861 100644 --- a/10_telephone/telephone.py +++ b/10_telephone/telephone.py @@ -6,47 +6,40 @@ """ import argparse - +import os # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Telephone', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') - - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') + parser.add_argument('text', + metavar='text', + help='Input text or file') - parser.add_argument('-i', - '--int', - help='A named integer argument', + parser.add_argument('-s', + '--seed', + help='Random seed', metavar='int', type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), default=None) - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + parser.add_argument('-m', + '--mutations', + help='Percent mutations', + metavar='float', + type=float, + default=0.1) + + args = parser.parse_args() + + if os.path.isfile(args.text): + args.text = open(args.text).read().rstrip() - return parser.parse_args() + return args # -------------------------------------------------- From 022db0fb1c17a8ca76814982d767c8ed205eaf09 Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 8 Feb 2021 13:13:00 -0800 Subject: [PATCH 54/63] Add arg checks --- 10_telephone/telephone.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/10_telephone/telephone.py b/10_telephone/telephone.py index 5e90e3861..17b2e7a28 100644 --- a/10_telephone/telephone.py +++ b/10_telephone/telephone.py @@ -36,6 +36,9 @@ def get_args(): args = parser.parse_args() + if args.mutations < 0 or args.mutations > 1: + parser.error(f'--mutations "{args.mutations}" must be between 0 and 1') + if os.path.isfile(args.text): args.text = open(args.text).read().rstrip() From 569300e91890b28f8196169dfe5733aa3e5f693e Mon Sep 17 00:00:00 2001 From: fleid Date: Mon, 8 Feb 2021 13:59:29 -0800 Subject: [PATCH 55/63] Pass all tests --- 10_telephone/telephone.py | 26 +++++++++++++++----------- README_fleide.md | 12 +++++++++++- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/10_telephone/telephone.py b/10_telephone/telephone.py index 17b2e7a28..a1a238877 100644 --- a/10_telephone/telephone.py +++ b/10_telephone/telephone.py @@ -7,6 +7,8 @@ import argparse import os +import random +import string # -------------------------------------------------- def get_args(): @@ -50,18 +52,20 @@ def main(): """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional - - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + random.seed(args.seed) + num_mutations = round(len(args.text) * args.mutations) + alpha = ''.join(sorted(string.ascii_letters + string.punctuation)) + indexes = random.sample(range(len(args.text)), num_mutations) + + mutated = args.text + for i in indexes: + mutation = random.choice(alpha.replace(mutated[i],'')) #removing the current char from the options + mutated = mutated[:i]+mutation+mutated[i+1:] + + + print(f'You said: "{args.text}"') + print(f'I heard : "{mutated}"') # -------------------------------------------------- if __name__ == '__main__': diff --git a/README_fleide.md b/README_fleide.md index 26d441815..9d1d6ab76 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -97,6 +97,12 @@ word[n:p] # substring() word[:p] # left() word[n:] # right() +# mutating via a list + +text = list(text) +text[13] = 'A' +text = ''.join(text) + ``` ## Chapter 3 - Lists @@ -350,8 +356,12 @@ sys.exit('Whatever') # returns 1 on STDERR/2 ``` -## Chapter 10 - +## Chapter 10 - String library ```PYTHON +import string + +alpha = ''.join(sorted(string.ascii_letters + string.punctuation)) + ``` \ No newline at end of file From 8728b221af6a451aba873576d173184d499fe37a Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 11 Feb 2021 13:35:18 -0800 Subject: [PATCH 56/63] Prep chapter 11 --- .../Makefile | 0 .../README.md | 0 .../all_test.sh | 0 11_bottles_of_beer/bottles.py | 72 +++++++++++++++++++ .../mk-sums.sh | 0 .../solution.py | 0 .../sums.txt | 0 .../test.py | 0 8 files changed, 72 insertions(+) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/Makefile (100%) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/README.md (100%) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/all_test.sh (100%) create mode 100644 11_bottles_of_beer/bottles.py rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/mk-sums.sh (100%) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/solution.py (100%) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/sums.txt (100%) rename {00_TODO/11_bottles_of_beer => 11_bottles_of_beer}/test.py (100%) diff --git a/00_TODO/11_bottles_of_beer/Makefile b/11_bottles_of_beer/Makefile similarity index 100% rename from 00_TODO/11_bottles_of_beer/Makefile rename to 11_bottles_of_beer/Makefile diff --git a/00_TODO/11_bottles_of_beer/README.md b/11_bottles_of_beer/README.md similarity index 100% rename from 00_TODO/11_bottles_of_beer/README.md rename to 11_bottles_of_beer/README.md diff --git a/00_TODO/11_bottles_of_beer/all_test.sh b/11_bottles_of_beer/all_test.sh similarity index 100% rename from 00_TODO/11_bottles_of_beer/all_test.sh rename to 11_bottles_of_beer/all_test.sh diff --git a/11_bottles_of_beer/bottles.py b/11_bottles_of_beer/bottles.py new file mode 100644 index 000000000..d6f50d0f2 --- /dev/null +++ b/11_bottles_of_beer/bottles.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-02-11 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/11_bottles_of_beer/mk-sums.sh b/11_bottles_of_beer/mk-sums.sh similarity index 100% rename from 00_TODO/11_bottles_of_beer/mk-sums.sh rename to 11_bottles_of_beer/mk-sums.sh diff --git a/00_TODO/11_bottles_of_beer/solution.py b/11_bottles_of_beer/solution.py similarity index 100% rename from 00_TODO/11_bottles_of_beer/solution.py rename to 11_bottles_of_beer/solution.py diff --git a/00_TODO/11_bottles_of_beer/sums.txt b/11_bottles_of_beer/sums.txt similarity index 100% rename from 00_TODO/11_bottles_of_beer/sums.txt rename to 11_bottles_of_beer/sums.txt diff --git a/00_TODO/11_bottles_of_beer/test.py b/11_bottles_of_beer/test.py similarity index 100% rename from 00_TODO/11_bottles_of_beer/test.py rename to 11_bottles_of_beer/test.py From 64a905a4a88f4b07b4ee4f08e703b6b6f188488e Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 11 Feb 2021 13:54:48 -0800 Subject: [PATCH 57/63] Pass first 5 tests --- 11_bottles_of_beer/bottles.py | 84 ++++++++++++++++++----------------- README_fleide.md | 19 +++++++- 2 files changed, 62 insertions(+), 41 deletions(-) diff --git a/11_bottles_of_beer/bottles.py b/11_bottles_of_beer/bottles.py index d6f50d0f2..18932eeb1 100644 --- a/11_bottles_of_beer/bottles.py +++ b/11_bottles_of_beer/bottles.py @@ -2,7 +2,7 @@ """ Author : fleide Date : 2021-02-11 -Purpose: Rock the Casbah +Purpose: Chapter 11 """ import argparse @@ -13,40 +13,54 @@ def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Bottles of beer song', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') - - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', - metavar='int', + parser.add_argument('-n', + '--num', + help='How many bottles', + metavar='number', type=int, - default=0) + default=10) - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), - default=None) + args = parser.parse_args() - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + if args.num < 1: + parser.error(f'--num "{args.num}" must be greater than 0') - return parser.parse_args() + return args + + +# -------------------------------------------------- +def verse(bottle): + """Sing a verse""" + return '\n'.join([ + '1 bottle of beer on the wall,' + '1 bottle of beer,', + 'Take one down, pass it around,', + 'No more bottles of beer on the wall!' + ]) + + +# -------------------------------------------------- +def test_verse(): + """Test verse""" + + last_verse = verse(1) + assert last_verse == '\n'.join([ + '1 bottle of beer on the wall,' + '1 bottle of beer,', + 'Take one down, pass it around,', + 'No more bottles of beer on the wall!' + ]) + + two_bottles = verse(2) + assert two_bottles == '\n'.join([ + '2 bottles of beer on the wall,' + '2 bottles of beer,', + 'Take one down, pass it around,', + '1 bottle of beer on the wall!' + ]) # -------------------------------------------------- @@ -54,18 +68,8 @@ def main(): """Make a jazz noise here""" args = get_args() - str_arg = args.arg - int_arg = args.int - file_arg = args.file - flag_arg = args.on - pos_arg = args.positional - - print(f'str_arg = "{str_arg}"') - print(f'int_arg = "{int_arg}"') - print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) - print(f'flag_arg = "{flag_arg}"') - print(f'positional = "{pos_arg}"') + num_list = list(range(args.num, 0, -1)) # -------------------------------------------------- if __name__ == '__main__': diff --git a/README_fleide.md b/README_fleide.md index 9d1d6ab76..da9625b4d 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -131,6 +131,8 @@ items.reverse() #in-place sorted(items) # returns a new sorted list reversed(items) #returns a new reversed list, lazy, needs to be invoked via list(...) +list(range(0, 10, 2)) # range is lazy, list forces the output. Here 2 is the step + items_joined = ', '.join(items) # output a single string with separator # easier way to generate a list of individual static words @@ -364,4 +366,19 @@ import string alpha = ''.join(sorted(string.ascii_letters + string.punctuation)) -``` \ No newline at end of file +``` + +## Chapter 11 - Functions + +`pytest myprogram.py` with naming convention `def test_myfunction()` will run tests included in the file. + + +```PYTHON + +def test_myfunction(): + """Test myfunction""" + + myfunction_1 = myfunction(1) + assert myfunction_1 == 'Expected value for 1' + +``` From a120e2296bddeb34dcb346c93b9f304f4e4164ad Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 11 Feb 2021 14:52:55 -0800 Subject: [PATCH 58/63] Pass all tests --- 11_bottles_of_beer/bottles.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/11_bottles_of_beer/bottles.py b/11_bottles_of_beer/bottles.py index 18932eeb1..436253667 100644 --- a/11_bottles_of_beer/bottles.py +++ b/11_bottles_of_beer/bottles.py @@ -34,11 +34,16 @@ def get_args(): # -------------------------------------------------- def verse(bottle): """Sing a verse""" + + first = 's' if bottle > 1 else '' + second = '' if bottle == 2 else 's' + last = 'No more' if bottle == 1 else bottle-1 + return '\n'.join([ - '1 bottle of beer on the wall,' - '1 bottle of beer,', + f'{bottle} bottle{first} of beer on the wall,', + f'{bottle} bottle{first} of beer,', 'Take one down, pass it around,', - 'No more bottles of beer on the wall!' + f'{last} bottle{second} of beer on the wall!' ]) @@ -48,7 +53,7 @@ def test_verse(): last_verse = verse(1) assert last_verse == '\n'.join([ - '1 bottle of beer on the wall,' + '1 bottle of beer on the wall,', '1 bottle of beer,', 'Take one down, pass it around,', 'No more bottles of beer on the wall!' @@ -56,7 +61,7 @@ def test_verse(): two_bottles = verse(2) assert two_bottles == '\n'.join([ - '2 bottles of beer on the wall,' + '2 bottles of beer on the wall,', '2 bottles of beer,', 'Take one down, pass it around,', '1 bottle of beer on the wall!' @@ -70,6 +75,9 @@ def main(): args = get_args() num_list = list(range(args.num, 0, -1)) + for i in num_list: + print(verse(i) + ('\n' if i > 1 else '')) + # -------------------------------------------------- if __name__ == '__main__': From bd55f8377d182075e688b237c0e9c62911c4f5c0 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 11 Feb 2021 15:54:02 -0800 Subject: [PATCH 59/63] Alternate with map --- 11_bottles_of_beer/bottles.py | 7 +++++-- README_fleide.md | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/11_bottles_of_beer/bottles.py b/11_bottles_of_beer/bottles.py index 436253667..d31455897 100644 --- a/11_bottles_of_beer/bottles.py +++ b/11_bottles_of_beer/bottles.py @@ -75,8 +75,11 @@ def main(): args = get_args() num_list = list(range(args.num, 0, -1)) - for i in num_list: - print(verse(i) + ('\n' if i > 1 else '')) + + #for i in num_list: + # print(verse(i) + ('\n' if i > 1 else '')) + + print('\n\n'.join(map(verse,range(args.num, 0, -1)))) # -------------------------------------------------- diff --git a/README_fleide.md b/README_fleide.md index da9625b4d..2d041a9e8 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -294,7 +294,6 @@ def new_char(c): new_text = ''.join(map(new_char,text)) - # Using the map (lazy) function with anonymous function (lambda) new_text = ''.join( From 507b715e6545d781b96df5af468b691cd83053d0 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 1 Apr 2021 11:47:53 -0700 Subject: [PATCH 60/63] Add comment to map syntax --- 11_bottles_of_beer/bottles.py | 1 + 1 file changed, 1 insertion(+) diff --git a/11_bottles_of_beer/bottles.py b/11_bottles_of_beer/bottles.py index d31455897..706c5925c 100644 --- a/11_bottles_of_beer/bottles.py +++ b/11_bottles_of_beer/bottles.py @@ -79,6 +79,7 @@ def main(): #for i in num_list: # print(verse(i) + ('\n' if i > 1 else '')) + # String joins the result of applying verse to the range print('\n\n'.join(map(verse,range(args.num, 0, -1)))) From 39677b33fd8a4337c0f936992b6470382211f199 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 1 Apr 2021 11:52:46 -0700 Subject: [PATCH 61/63] Init chapter 12 --- {00_TODO/12_ransom => 12_ransom}/Makefile | 0 {00_TODO/12_ransom => 12_ransom}/README.md | 0 {00_TODO/12_ransom => 12_ransom}/all_test.sh | 0 12_ransom/ransom.py | 72 +++++++++++++++++++ .../solution1_for_loop.py | 0 .../solution2_for_append_list.py | 0 .../solution3_for_append_string.py | 0 .../solution4_list_comprehension.py | 0 .../solution5_shorter_list_comp.py | 0 .../12_ransom => 12_ransom}/solution6_map.py | 0 .../solution7_shorter_map.py | 0 {00_TODO/12_ransom => 12_ransom}/test.py | 0 README_fleide.md | 9 +++ 13 files changed, 81 insertions(+) rename {00_TODO/12_ransom => 12_ransom}/Makefile (100%) rename {00_TODO/12_ransom => 12_ransom}/README.md (100%) rename {00_TODO/12_ransom => 12_ransom}/all_test.sh (100%) create mode 100644 12_ransom/ransom.py rename {00_TODO/12_ransom => 12_ransom}/solution1_for_loop.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution2_for_append_list.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution3_for_append_string.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution4_list_comprehension.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution5_shorter_list_comp.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution6_map.py (100%) rename {00_TODO/12_ransom => 12_ransom}/solution7_shorter_map.py (100%) rename {00_TODO/12_ransom => 12_ransom}/test.py (100%) diff --git a/00_TODO/12_ransom/Makefile b/12_ransom/Makefile similarity index 100% rename from 00_TODO/12_ransom/Makefile rename to 12_ransom/Makefile diff --git a/00_TODO/12_ransom/README.md b/12_ransom/README.md similarity index 100% rename from 00_TODO/12_ransom/README.md rename to 12_ransom/README.md diff --git a/00_TODO/12_ransom/all_test.sh b/12_ransom/all_test.sh similarity index 100% rename from 00_TODO/12_ransom/all_test.sh rename to 12_ransom/all_test.sh diff --git a/12_ransom/ransom.py b/12_ransom/ransom.py new file mode 100644 index 000000000..6500c183f --- /dev/null +++ b/12_ransom/ransom.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Author : fleide +Date : 2021-04-01 +Purpose: Rock the Casbah +""" + +import argparse + + +# -------------------------------------------------- +def get_args(): + """Get command-line arguments""" + + parser = argparse.ArgumentParser( + description='Rock the Casbah', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('positional', + metavar='str', + help='A positional argument') + + parser.add_argument('-a', + '--arg', + help='A named string argument', + metavar='str', + type=str, + default='') + + parser.add_argument('-i', + '--int', + help='A named integer argument', + metavar='int', + type=int, + default=0) + + parser.add_argument('-f', + '--file', + help='A readable file', + metavar='FILE', + type=argparse.FileType('rt'), + default=None) + + parser.add_argument('-o', + '--on', + help='A boolean flag', + action='store_true') + + return parser.parse_args() + + +# -------------------------------------------------- +def main(): + """Make a jazz noise here""" + + args = get_args() + str_arg = args.arg + int_arg = args.int + file_arg = args.file + flag_arg = args.on + pos_arg = args.positional + + print(f'str_arg = "{str_arg}"') + print(f'int_arg = "{int_arg}"') + print('file_arg = "{}"'.format(file_arg.name if file_arg else '')) + print(f'flag_arg = "{flag_arg}"') + print(f'positional = "{pos_arg}"') + + +# -------------------------------------------------- +if __name__ == '__main__': + main() diff --git a/00_TODO/12_ransom/solution1_for_loop.py b/12_ransom/solution1_for_loop.py similarity index 100% rename from 00_TODO/12_ransom/solution1_for_loop.py rename to 12_ransom/solution1_for_loop.py diff --git a/00_TODO/12_ransom/solution2_for_append_list.py b/12_ransom/solution2_for_append_list.py similarity index 100% rename from 00_TODO/12_ransom/solution2_for_append_list.py rename to 12_ransom/solution2_for_append_list.py diff --git a/00_TODO/12_ransom/solution3_for_append_string.py b/12_ransom/solution3_for_append_string.py similarity index 100% rename from 00_TODO/12_ransom/solution3_for_append_string.py rename to 12_ransom/solution3_for_append_string.py diff --git a/00_TODO/12_ransom/solution4_list_comprehension.py b/12_ransom/solution4_list_comprehension.py similarity index 100% rename from 00_TODO/12_ransom/solution4_list_comprehension.py rename to 12_ransom/solution4_list_comprehension.py diff --git a/00_TODO/12_ransom/solution5_shorter_list_comp.py b/12_ransom/solution5_shorter_list_comp.py similarity index 100% rename from 00_TODO/12_ransom/solution5_shorter_list_comp.py rename to 12_ransom/solution5_shorter_list_comp.py diff --git a/00_TODO/12_ransom/solution6_map.py b/12_ransom/solution6_map.py similarity index 100% rename from 00_TODO/12_ransom/solution6_map.py rename to 12_ransom/solution6_map.py diff --git a/00_TODO/12_ransom/solution7_shorter_map.py b/12_ransom/solution7_shorter_map.py similarity index 100% rename from 00_TODO/12_ransom/solution7_shorter_map.py rename to 12_ransom/solution7_shorter_map.py diff --git a/00_TODO/12_ransom/test.py b/12_ransom/test.py similarity index 100% rename from 00_TODO/12_ransom/test.py rename to 12_ransom/test.py diff --git a/README_fleide.md b/README_fleide.md index 2d041a9e8..034d4c026 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -7,6 +7,15 @@ Terminal displays: - Bottom left (alt shift -), **test** : `pytest -v -x test.py` or `make` if there's a Makefile - Bottom right (alt shift =), **git** : `git add.` `git commit -m ...`, `git push origin master` +New chapter: +```BASH +cd ~/repos/tiny_python_projects +mv 00_TODO/XX_yyy XX_yyy +./bin/new.py XX_yyy/zzz.py +git add . +git commit -m "Init chapter XX" +``` + ## Chapter 0 - Installation First pip was missing so: From 87fff9b20ca4f3aa9593de85afd6d57398544718 Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 1 Apr 2021 11:53:41 -0700 Subject: [PATCH 62/63] Add chapter 12 to readme --- README_fleide.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README_fleide.md b/README_fleide.md index 034d4c026..f91bc2b61 100644 --- a/README_fleide.md +++ b/README_fleide.md @@ -376,7 +376,7 @@ alpha = ''.join(sorted(string.ascii_letters + string.punctuation)) ``` -## Chapter 11 - Functions +## Chapter 11 - Functions (testing) `pytest myprogram.py` with naming convention `def test_myfunction()` will run tests included in the file. @@ -390,3 +390,6 @@ def test_myfunction(): assert myfunction_1 == 'Expected value for 1' ``` + +## Chapter 12 - Random bis + From 6d6c3bc397631758c42b2e93c41a0179120e8eab Mon Sep 17 00:00:00 2001 From: fleid Date: Thu, 1 Apr 2021 15:44:29 -0700 Subject: [PATCH 63/63] Add arguments --- 12_ransom/ransom.py | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/12_ransom/ransom.py b/12_ransom/ransom.py index 6500c183f..dd2a610eb 100644 --- a/12_ransom/ransom.py +++ b/12_ransom/ransom.py @@ -6,6 +6,7 @@ """ import argparse +import os # -------------------------------------------------- @@ -13,40 +14,24 @@ def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( - description='Rock the Casbah', + description='Ransom Note', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('positional', - metavar='str', - help='A positional argument') + parser.add_argument('text', + metavar='text', + help='Input text or file') - parser.add_argument('-a', - '--arg', - help='A named string argument', - metavar='str', - type=str, - default='') - - parser.add_argument('-i', - '--int', - help='A named integer argument', + parser.add_argument('-s', + '--seed', + help='Random seed', metavar='int', type=int, - default=0) - - parser.add_argument('-f', - '--file', - help='A readable file', - metavar='FILE', - type=argparse.FileType('rt'), default=None) - parser.add_argument('-o', - '--on', - help='A boolean flag', - action='store_true') + args = parser.parse_args() - return parser.parse_args() + if os.path.isfile(args.text): + args.text = open(args.text).read().rstrip() # --------------------------------------------------