├── .gitignore ├── Admin └── README ├── Breakouts ├── 04_IPythonNotebookIntroduction │ ├── breakout.ipynb │ └── breakout_solution.ipynb ├── 13_AdvancedIPython │ ├── Advanced IPython Breakout Solutions.ipynb │ ├── Advanced IPython Breakout.ipynb │ ├── Interactive Image Comparisons.ipynb │ ├── University_of_Sheffield_coat_of_arms_new.png │ └── University_of_Sheffield_coat_of_arms_old.png ├── Questions │ ├── 01_BasicTraining │ │ ├── b1sol.py │ │ ├── breakout_1.ipynb │ │ └── breakout_1_solution.ipynb │ ├── Breakout Survival.ipynb │ ├── Development │ │ └── development_breakout_instruction.txt │ ├── Homework Day #2.html │ ├── Homework Day #2.ipynb │ ├── OOP_I_Breakout_prob.pdf │ ├── breakout2_question.pdf │ ├── funcs_and_mods_breakout.pdf │ ├── monday_homework1.key │ ├── monday_homework1.pdf │ └── trends.csv ├── README └── Solutions │ ├── 01_BasicTraining │ └── breakout1.py │ ├── 02_AdvancedDataStructures │ ├── breakout02_solutions.ipynb │ ├── style.css │ └── talktools.py │ ├── 03_FunctionsAndModules │ ├── age.ipynb │ ├── age.py │ ├── age1-docopt.py │ ├── age1.py │ ├── breakout3.key │ └── breakout3.pdf │ ├── 05_NumpyMatplotlib │ ├── trapezoid_rule_solution.pdf │ ├── trapezoid_rule_solution.v2.ipynb │ └── trapezoid_rule_solution.v3.ipynb │ ├── 06_AdvancedStrings │ ├── Breakout6Solution.pdf │ ├── Breakout6Solution.py │ ├── Breakout6Solution.v2.ipynb │ ├── Breakout6Solution.v3.ipynb │ ├── elie.info │ └── elie.ofni │ ├── 07_AdvancedStuff │ ├── Breakout Survival Solution.ipynb │ ├── Breakout7Solution.ipynb │ └── Breakout7Solution.py │ ├── 08_OOPI │ └── OOP_I_solutions.ipynb │ ├── 20_matplotlib │ └── breakout_10.ipynb │ ├── Development │ └── development_breakout_solution.txt │ └── hw2sol.py ├── DataFiles_and_Notebooks ├── 01_BasicTraining │ ├── 01_basic_training.ipynb │ ├── basic_training.ipynb │ ├── hello.cpp │ ├── hello.f │ ├── hello.java │ ├── hello.py │ ├── spam.png │ ├── style.css │ ├── talktools.py │ ├── temp1.py │ └── temp2.py ├── 02_AdvancedDataStructures │ ├── airline.py │ ├── data_structures.ipynb │ └── data_structures.pdf ├── 03_FunctionsAndModules │ ├── getinfo.py │ ├── modfun.py │ ├── numfun1.py │ ├── numfun2.py │ ├── numop1.html │ └── numop1.py ├── 04_IPythonNotebookIntroduction │ ├── 00_notebook_tour.ipynb │ ├── 01_notebook_introduction.ipynb │ ├── animation.m4v │ ├── breakout.ipynb │ └── ipython-tutor.ipynb ├── 05_NumpyMatplotlib │ ├── Numpy+Matplotlib.ipynb │ ├── Numpy+Matplotlib.nb.pdf │ ├── Numpy+Matplotlib.v2.ipynb │ ├── data.txt │ ├── trapezoid_rule.pdf │ ├── trapezoid_rule.v2.ipynb │ └── trapezoid_rule.v3.ipynb ├── 06_AdvancedStrings │ ├── advanced_strings.ipynb │ ├── advanced_strings.pdf │ ├── checkemail.py │ ├── google_share_price.csv │ └── tabbify_my_csv.py ├── 07_AdvancedInteractions │ ├── advanced_interactions.ipynb │ ├── advanced_interactions.pdf │ └── airline.py ├── 08_OOPI │ └── OOP_I.py ├── 09_OOPII │ ├── bear.py │ ├── bear1.py │ ├── bear2.py │ ├── catcherr.py │ ├── downgradenb.py │ ├── oopII.ipynb │ ├── oopII.v2.ipynb │ └── subclass.py ├── 11_ScientificProgrammingI │ ├── C.mat │ ├── SP1_P2_data.txt │ ├── SP1_P3_data.txt │ ├── SciPyAnswers_1.ipynb │ ├── SciPyAnswers_1.v2.ipynb │ ├── SciPyAnswers_2.ipynb │ ├── SciPyAnswers_2.v2.ipynb │ ├── SciPyAnswers_3.ipynb │ ├── SciPyAnswers_3.v2.ipynb │ ├── SciPyProblems_1.ipynb │ ├── SciPyProblems_1.v2.ipynb │ ├── SciPyProblems_2.ipynb │ ├── SciPyProblems_2.v2.ipynb │ ├── SciPyProblems_3.ipynb │ ├── SciPyProblems_3.v2.ipynb │ ├── ScientificProgrammingI.ipynb │ ├── ScientificProgrammingI.v2.ipynb │ ├── example.f90 │ ├── testbox.mat │ └── wiggleZ_DR1_z.dat ├── 12_Testing │ ├── animals │ │ ├── animals_0.py │ │ ├── animals_1.py │ │ ├── animals_2.py │ │ └── animals_3.py │ ├── doctests_example.py │ ├── example1 │ │ └── nose_example1.py │ ├── logging │ │ ├── loggin1.py │ │ └── loggin2.py │ ├── my_assertions.py │ ├── test_simple.py │ ├── tryexcept0.py │ └── tryexcept1.py ├── 13_AdvancedIPython │ ├── Basic debugging in the Notebook.ipynb │ ├── Breakout-Image comparisons.ipynb │ ├── Custom Display Logic.ipynb │ ├── Image Processing.ipynb │ ├── Index.ipynb │ ├── Multiple languages from inside IPython.ipynb │ ├── Rich Output.ipynb │ ├── University_of_Sheffield_coat_of_arms_new.png │ ├── University_of_Sheffield_coat_of_arms_old.png │ ├── Using Interact.ipynb │ ├── animation.m4v │ ├── ipython_logo.png │ └── python_logo.svg ├── 15_Appetite.zip ├── 15_Appetite │ ├── NothingToSeeHere.py │ ├── Overview.ipynb │ ├── README.md │ ├── appetite.py │ ├── get_tweets.py │ ├── hello1.py │ ├── hello2.py │ ├── hello3.py │ ├── hello4.py │ ├── hello5.py │ ├── hello6.py │ ├── simple_scraper.py │ ├── templates │ │ ├── tweet.html │ │ ├── tweets.html │ │ └── user_dummy.html │ └── twitter_init.py ├── 16_InternetQuery │ └── craigslist_date_search.ipynb └── README ├── Homeworks ├── Homework_01 │ ├── HomeworkSolutionI.ipynb │ ├── HomeworkSolutionI.pdf │ ├── HomeworkSolutionI.v2.ipynb │ ├── HomeworkSolutionI.v3.ipynb │ ├── HomeworkSolutionI_pandas.ipynb │ ├── Homework_01.pdf │ ├── monday_homework1.pdf │ └── trends.csv └── Homework_02 │ ├── homework2.pdf │ ├── hw_2_solutions.py │ └── hw_2_solutions.pyc ├── LICENSE ├── Lectures ├── 00_Introduction │ ├── day_1_intro.key │ └── day_1_intro.pdf ├── 01_BasicTraining │ ├── 01_basic_training.ipynb │ ├── day_1_basic_training.key │ ├── day_1_basic_training.pdf │ ├── day_1_basic_training_slide1.png │ ├── day_1_basic_training_slide2.png │ ├── spam.png │ ├── style.css │ └── talktools.py ├── 02_AdvancedDataStructures │ ├── 02_AdvancedDataStructures.ipynb │ ├── day1_data_structures.key │ ├── day1_data_structures.pdf │ └── slide1.png ├── 03_FunctionsAndModules │ ├── day1_functions_and_modules.ipynb │ ├── day1_modules_def_io.key │ ├── day1_modules_def_io.pdf │ ├── getinfo.py │ ├── josh1.py │ ├── josh2.py │ ├── modfun.py │ ├── numfun1.py │ ├── numfun2.py │ ├── numop1.py │ └── script_name.py ├── 04_IPythonNotebookIntroduction │ ├── Exercises.ipynb │ ├── IPython - beyond plain Python.ipynb │ ├── Markdown Cells.ipynb │ ├── Notebook Basics.ipynb │ ├── README.md │ ├── animation.m4v │ ├── mknbindex.py │ ├── python-logo.svg │ ├── style.css │ └── talktools.py ├── 05_NumpyPandasMatplotlib │ ├── AAPL.csv │ ├── Exercise-FourierImageDenoise.ipynb │ ├── Exercise-FourierImageDenoiseSolution.ipynb │ ├── Exercise-TrapezoidRule-Solution.ipynb │ ├── Exercise-TrapezoidRule.ipynb │ ├── IntroMatplotlib.ipynb │ ├── IntroNumPy.ipynb │ ├── IntroPandas.ipynb │ ├── README.md │ ├── array_memory_strides.png │ ├── array_memory_strides.svg │ ├── broadcast_1D.png │ ├── broadcast_box.png │ ├── broadcast_rougier.png │ ├── broadcast_rougier.txt │ ├── dessert.png │ ├── dtype.png │ ├── moon_denoise.png │ ├── moonlanding.png │ ├── numpy_broadcasting.svg │ ├── pandas-book.jpg │ └── trapezoidal_rule.png ├── 06_AdvancedStrings │ ├── advanced_strings.ipynb │ ├── day_2_advanced_strings.key │ ├── day_2_advanced_strings.pdf │ ├── day_2_advanced_strings_python3.key │ └── google_share_price.csv ├── 07_AdvancedInteractions │ ├── advanced_interactions.ipynb │ ├── airline.py │ ├── day2_advanced_interactions.key │ └── day2_advanced_interactions.pdf ├── 08_OOPI │ ├── OOPI-v2.ipynb │ └── old │ │ ├── OOP1-intro.ipynb │ │ ├── OOP1-nb.ipynb │ │ ├── Object_Oriented_I.key │ │ ├── Object_Oriented_I.pdf │ │ ├── anchorman.png │ │ ├── anchorman2.png │ │ ├── custom.js │ │ ├── oop1_plots.py │ │ ├── oski.png │ │ ├── style.css │ │ ├── talktools.py │ │ └── toolbar-slideshow.png ├── 09_OOPII │ ├── day2_oopII.key │ └── day2_oopII.pdf ├── 10_GitDevelopment │ ├── .DS_Store │ ├── Development with Git.pdf │ ├── DevelopmentWithGit.pdf │ └── VersionControl.ipynb ├── 11_ScientificProgrammingI │ ├── Nightingale-sound.license │ ├── ScientificProgrammingI.key │ ├── ScientificProgrammingI.pdf │ ├── bubbles.jpg │ ├── kdtree.png │ ├── kdtree_2d.png │ ├── nightingale.wav │ ├── nxdraw.py │ ├── scipy.ipynb │ ├── scipy_fft.ipynb │ ├── scipy_linalg_sparse.ipynb │ ├── scipy_ndimage.ipynb │ ├── scipy_spatial.ipynb │ ├── sliding_win.png │ ├── sparse_graph.png │ ├── triceratops.jpg │ └── triceratops.obj ├── 12_Testing │ ├── 12_breakout.ipynb │ ├── 12_breakout_2.ipynb │ ├── 12_breakout_soln.ipynb │ ├── 12_testing.ipynb │ ├── alloc_norm_mul.py │ ├── alloc_norm_mul_opt.py │ ├── breakout.ipynb │ ├── ivanov2012-08-22.pdf │ ├── pocket │ │ ├── __init__.py │ │ ├── ops.py │ │ └── tests │ │ │ └── test_ops.py │ ├── profile_it.sh │ ├── square_task.py │ ├── test_alloc_norm_mul.py │ └── tldr.gif ├── 13_AdvancedIPython │ ├── Advanced IPython.ipynb │ ├── Custom Display Logic.ipynb │ ├── mycircle.py │ └── mycircle2.py ├── 14_ScentificWorkflows │ ├── README.md │ ├── neurons │ │ ├── RingExp.ogv │ │ ├── neurons.hf5 │ │ └── neurons.ipynb │ └── supernovae │ │ ├── .gitignore │ │ ├── data_utils.py │ │ ├── download_data.py │ │ ├── explore.ipynb │ │ ├── fitting.py │ │ ├── runall.py │ │ ├── slides.odp │ │ └── test.py ├── 15_Appetite │ └── Appetite.pdf ├── 16_Closing │ ├── closing_lecture.key │ └── closing_lecture.pdf ├── 20_matplotlib │ ├── MatPlotLib-Breakout-answers.ipynb │ ├── MatPlotLib-Breakout-noanswers.ipynb │ ├── MatPlotLib_Tutorial.ipynb │ ├── breakout_10_1.png │ ├── breakout_10_3a.png │ ├── breakout_10_3b.png │ ├── breakout_10_3c.png │ ├── data │ │ ├── bay_area_rentals.csv │ │ ├── dessert.png │ │ ├── don.png │ │ ├── stations.txt │ │ └── tips.csv │ ├── matplotlibrc │ ├── style.css │ └── talktools.py ├── 21_NumpyMatplotlib │ ├── Delicious3ColorCake.pdf │ ├── Exercise-FourierImageDenoise.ipynb │ ├── Exercise-FourierImageDenoiseSolution.ipynb │ ├── Exercise-TrapezoidRule-Solution.ipynb │ ├── Exercise-TrapezoidRule.ipynb │ ├── IntroMatplolib.ipynb │ ├── IntroNumPy.ipynb │ ├── array_memory_strides.png │ ├── broadcast_1D.png │ ├── broadcast_rougier.png │ ├── broadcast_rougier.txt │ ├── moon_denoise.png │ ├── moonlanding.png │ ├── my_great_fig.svg │ ├── myfig.png │ ├── numpy_broadcasting.svg │ ├── test.npy │ ├── test.npz │ ├── trapezoidal_rule.png │ └── trump.png ├── 22_PandasSciPy │ ├── 01_exercise_pandas.ipynb │ ├── 01_intro_numpy_pandas.ipynb │ ├── 01_solutions_pandas.ipynb │ ├── data │ │ ├── 2002FemPreg.csv.gz │ │ └── AAPL.csv │ ├── figures │ │ ├── cumulative_snowfall.png │ │ └── pandas-book.jpg │ └── scipy_overview.ipynb ├── README └── Videos │ ├── pyboot2013videos_day1.ipynb │ └── pyboot2013videos_day2.ipynb ├── README.md ├── nb2to3.py ├── schedule.md └── workshop_checklist.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.bbl 3 | *.blg 4 | *.dvi 5 | *.fdb_latexmk 6 | *.glg 7 | *.glo 8 | *.gls 9 | *.idx 10 | *.ilg 11 | *.ind 12 | *.ist 13 | *.lof 14 | *.log 15 | *.lot 16 | *.nav 17 | *.nlo 18 | *.out 19 | *.pdfsync 20 | *.ps 21 | *.snm 22 | *.synctex.gz 23 | *.toc 24 | *.vrb 25 | *.maf 26 | *.mtc 27 | *.mtc0 28 | .ipynb_checkpoints 29 | *~ 30 | \#* 31 | -------------------------------------------------------------------------------- /Admin/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Admin/README -------------------------------------------------------------------------------- /Breakouts/04_IPythonNotebookIntroduction/breakout.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# IPython Intro Breakout Session\n", 8 | "\n", 9 | "Interactive exploration\n", 10 | "-----------------------\n", 11 | "\n", 12 | "I have shown you the Zen of Python. But if you search through all of the python\n", 13 | "source code, you will not find the word \"Zen\" anywhere.\n", 14 | "\n", 15 | "\n", 16 | "\n", 17 | "Use ``, `?` and `??` on the `this` module to decode this string:" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": null, 23 | "metadata": { 24 | "collapsed": false 25 | }, 26 | "outputs": [], 27 | "source": [ 28 | "import this\n", 29 | "\n", 30 | "secret = \"Tbbq Wbo! abj tb fvta hc sbe gur znvyvat yvfg bire ng vclguba.bet\"" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "Configuration file options\n", 38 | "--------------------------\n", 39 | "\n", 40 | "Create the stub default profile (if you haven't already)\n", 41 | "\n", 42 | "\n", 43 | "\n", 44 | " $ ipython profile create\n", 45 | "\n", 46 | "\n", 47 | "\n", 48 | "This will create the stubs for the default profile\n", 49 | "\n", 50 | "now you can change these defaults.\n", 51 | "\n", 52 | "\n", 53 | "\n", 54 | "To find where your profile is stored:\n", 55 | "\n", 56 | "\n", 57 | "\n", 58 | " In [1]: import IPython\n", 59 | "\n", 60 | " In [2]: IPython.utils.path.locate_profile()\n", 61 | "\n", 62 | "\n", 63 | "\n", 64 | "Example:if you want the `_` and `__` methods to show up by default when doing tab-completion \n", 65 | "\n", 66 | "\n", 67 | "\n", 68 | " %config IPCompleter.omit__names\n", 69 | "\n", 70 | "Another example: you can add your own startup message (or execute your desired commands at startup) like I have:\n", 71 | "\n", 72 | " ~/.ipython/profile_default/startup/README\n", 73 | "\n", 74 | "\n", 75 | "\n", 76 | "\n", 77 | "\n", 78 | "\n", 79 | " " 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": null, 85 | "metadata": { 86 | "collapsed": false 87 | }, 88 | "outputs": [], 89 | "source": [ 90 | "import IPython\n", 91 | "IPython.utils.path.locate_profile()" 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": { 98 | "collapsed": false 99 | }, 100 | "outputs": [], 101 | "source": [ 102 | "IPython.utils.path.locate_profile()+'/startup/README'" 103 | ] 104 | }, 105 | { 106 | "cell_type": "code", 107 | "execution_count": null, 108 | "metadata": { 109 | "collapsed": false 110 | }, 111 | "outputs": [], 112 | "source": [ 113 | "%pycat IPython.utils.path.locate_profile()+'/startup/README'" 114 | ] 115 | } 116 | ], 117 | "metadata": { 118 | "kernelspec": { 119 | "display_name": "Python 3", 120 | "language": "python", 121 | "name": "python3" 122 | }, 123 | "language_info": { 124 | "codemirror_mode": { 125 | "name": "ipython", 126 | "version": 3 127 | }, 128 | "file_extension": ".py", 129 | "mimetype": "text/x-python", 130 | "name": "python", 131 | "nbconvert_exporter": "python", 132 | "pygments_lexer": "ipython3", 133 | "version": "3.4.3" 134 | } 135 | }, 136 | "nbformat": 4, 137 | "nbformat_minor": 0 138 | } 139 | -------------------------------------------------------------------------------- /Breakouts/13_AdvancedIPython/University_of_Sheffield_coat_of_arms_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/13_AdvancedIPython/University_of_Sheffield_coat_of_arms_new.png -------------------------------------------------------------------------------- /Breakouts/13_AdvancedIPython/University_of_Sheffield_coat_of_arms_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/13_AdvancedIPython/University_of_Sheffield_coat_of_arms_old.png -------------------------------------------------------------------------------- /Breakouts/Questions/01_BasicTraining/b1sol.py: -------------------------------------------------------------------------------- 1 | ## solutions to the breakout #1 (Day 1) 2 | sent = "" 3 | while True: 4 | newword = input("Please enter a word in the sentence (enter . ! or ? to end.): ") 5 | if newword == "." or newword == "?" or newword == "!": 6 | if len(sent) > 0: 7 | # get rid of the nasty space we added in 8 | sent = sent[:-1] 9 | sent += newword 10 | break 11 | 12 | sent += newword + " " 13 | print("...currently: " + sent) 14 | print("--->" + sent) 15 | ### created by Josh Bloom at UC Berkeley, 2010,2012,2013,2015 (ucbpythonclass+bootcamp@gmail.com) 16 | -------------------------------------------------------------------------------- /Breakouts/Questions/01_BasicTraining/breakout_1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "" 4 | }, 5 | "nbformat": 3, 6 | "nbformat_minor": 0, 7 | "worksheets": [ 8 | { 9 | "cells": [ 10 | { 11 | "cell_type": "heading", 12 | "level": 3, 13 | "metadata": {}, 14 | "source": [ 15 | "Exercise for the Breakout" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "Write a program which allows the user to build up a sentence one word at a time, stopping when they enter a period (.), exclamation (!), or question mark (?)" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "example interaction:" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "collapsed": false, 35 | "input": [ 36 | "%run b1sol.py" 37 | ], 38 | "language": "python", 39 | "metadata": {}, 40 | "outputs": [ 41 | { 42 | "name": "stdout", 43 | "output_type": "stream", 44 | "stream": "stdout", 45 | "text": [ 46 | "Please enter a word in the sentence (enter . ! or ? to end.): My\n" 47 | ] 48 | }, 49 | { 50 | "output_type": "stream", 51 | "stream": "stdout", 52 | "text": [ 53 | "...currently: My \n" 54 | ] 55 | }, 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "stream": "stdout", 60 | "text": [ 61 | "Please enter a word in the sentence (enter . ! or ? to end.): name\n" 62 | ] 63 | }, 64 | { 65 | "output_type": "stream", 66 | "stream": "stdout", 67 | "text": [ 68 | "...currently: My name \n" 69 | ] 70 | }, 71 | { 72 | "name": "stdout", 73 | "output_type": "stream", 74 | "stream": "stdout", 75 | "text": [ 76 | "Please enter a word in the sentence (enter . ! or ? to end.): is\n" 77 | ] 78 | }, 79 | { 80 | "output_type": "stream", 81 | "stream": "stdout", 82 | "text": [ 83 | "...currently: My name is \n" 84 | ] 85 | }, 86 | { 87 | "name": "stdout", 88 | "output_type": "stream", 89 | "stream": "stdout", 90 | "text": [ 91 | "Please enter a word in the sentence (enter . ! or ? to end.): Slim\n" 92 | ] 93 | }, 94 | { 95 | "output_type": "stream", 96 | "stream": "stdout", 97 | "text": [ 98 | "...currently: My name is Slim \n" 99 | ] 100 | }, 101 | { 102 | "name": "stdout", 103 | "output_type": "stream", 104 | "stream": "stdout", 105 | "text": [ 106 | "Please enter a word in the sentence (enter . ! or ? to end.): Shady\n" 107 | ] 108 | }, 109 | { 110 | "output_type": "stream", 111 | "stream": "stdout", 112 | "text": [ 113 | "...currently: My name is Slim Shady \n" 114 | ] 115 | }, 116 | { 117 | "name": "stdout", 118 | "output_type": "stream", 119 | "stream": "stdout", 120 | "text": [ 121 | "Please enter a word in the sentence (enter . ! or ? to end.): !\n" 122 | ] 123 | }, 124 | { 125 | "output_type": "stream", 126 | "stream": "stdout", 127 | "text": [ 128 | "--->My name is Slim Shady!\n" 129 | ] 130 | } 131 | ], 132 | "prompt_number": 1 133 | }, 134 | { 135 | "cell_type": "code", 136 | "collapsed": false, 137 | "input": [], 138 | "language": "python", 139 | "metadata": {}, 140 | "outputs": [] 141 | } 142 | ], 143 | "metadata": {} 144 | } 145 | ] 146 | } -------------------------------------------------------------------------------- /Breakouts/Questions/01_BasicTraining/breakout_1_solution.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "" 4 | }, 5 | "nbformat": 3, 6 | "nbformat_minor": 0, 7 | "worksheets": [ 8 | { 9 | "cells": [ 10 | { 11 | "cell_type": "code", 12 | "collapsed": false, 13 | "input": [ 14 | "%%writefile b1sol.py\n", 15 | "## solutions to the breakout #1 (Day 1)\n", 16 | "sent = \"\"\n", 17 | "while True:\n", 18 | " newword = raw_input(\"Please enter a word in the sentence (enter . ! or ? to end.): \")\n", 19 | " if newword == \".\" or newword == \"?\" or newword == \"!\":\n", 20 | " if len(sent) > 0:\n", 21 | " # get rid of the nasty space we added in\n", 22 | " sent = sent[:-1]\n", 23 | " sent += newword\n", 24 | " break\n", 25 | " \n", 26 | " sent += newword + \" \"\n", 27 | " print \"...currently: \" + sent\n", 28 | "print \"--->\" + sent\n", 29 | "### created by Josh Bloom at UC Berkeley, 2010,2012,2013 (ucbpythonclass+bootcamp@gmail.com)" 30 | ], 31 | "language": "python", 32 | "metadata": {}, 33 | "outputs": [ 34 | { 35 | "output_type": "stream", 36 | "stream": "stdout", 37 | "text": [ 38 | "Overwriting b1sol.py\n" 39 | ] 40 | } 41 | ], 42 | "prompt_number": 2 43 | }, 44 | { 45 | "cell_type": "code", 46 | "collapsed": false, 47 | "input": [], 48 | "language": "python", 49 | "metadata": {}, 50 | "outputs": [] 51 | } 52 | ], 53 | "metadata": {} 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /Breakouts/Questions/Breakout Survival.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "" 4 | }, 5 | "nbformat": 3, 6 | "nbformat_minor": 0, 7 | "worksheets": [ 8 | { 9 | "cells": [ 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "Survival Driven Development\n", 15 | "===========================\n", 16 | "\n", 17 | "Survival Driven Development (SDD) is the newest software development fad. In this development framework, you specify what the software is supposed to do, then randomly generate source code to fulfill these requirements. Most of these attempts will fail, but hopefully one will succeed.\n", 18 | "\n", 19 | "Your task is to use SDD to make a function to approximate `x**2 + x`.\n", 20 | "\n", 21 | "Hint 1: Randomly generate lambda functions using a restricted vocabulary of source fragments.
\n", 22 | "`vocab = ['x', 'x', ' ', '+', '-', '*', '/', '1', '2', '3']`\n", 23 | "\n", 24 | "Hint 2: Only evaluate `x` at a small-ish number of values and save the difference between those answers and the true value of `x**2 + x`.\n", 25 | "\n", 26 | "Hint 3: SDD is error prone. Be sure to catch your errors!" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "collapsed": false, 32 | "input": [ 33 | "import numpy\n", 34 | "import random" 35 | ], 36 | "language": "python", 37 | "metadata": {}, 38 | "outputs": [], 39 | "prompt_number": 1 40 | }, 41 | { 42 | "cell_type": "code", 43 | "collapsed": false, 44 | "input": [ 45 | "vocab = ['x', 'x', ' ', '+', '-', '*', '/', '1', '2', '3']\n", 46 | "n_chars = 10 # how many characters to try\n", 47 | "n_tries = 100000 # how many trials before we give up\n", 48 | "\n", 49 | "x = numpy.arange(-3, 3, 0.4)\n", 50 | "known_y = x**2 + x" 51 | ], 52 | "language": "python", 53 | "metadata": {}, 54 | "outputs": [], 55 | "prompt_number": 3 56 | }, 57 | { 58 | "cell_type": "code", 59 | "collapsed": false, 60 | "input": [ 61 | "for ...:\n", 62 | " " 63 | ], 64 | "language": "python", 65 | "metadata": {}, 66 | "outputs": [] 67 | } 68 | ], 69 | "metadata": {} 70 | } 71 | ] 72 | } -------------------------------------------------------------------------------- /Breakouts/Questions/Development/development_breakout_instruction.txt: -------------------------------------------------------------------------------- 1 | git clone git://github.com/brinkar/bloomdemo.git 2 | cd bloomdemo 3 | less INSTRUCTIONS -------------------------------------------------------------------------------- /Breakouts/Questions/Homework Day #2.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "" 4 | }, 5 | "nbformat": 3, 6 | "nbformat_minor": 0, 7 | "worksheets": [ 8 | { 9 | "cells": [ 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Chutes and Ladders in Monte Carlo ##" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "The game of Chutes and Ladders is pretty well known. What you didn't known until now is that you'd be cutting your Python chops in creating a simulation of the game for the purpose of gaining some serious insight. By keeping track of your simulations you'll learn some interesting things about such a simple game." 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "### Create a simulation of the game.###" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "The basic idea is to try to get to square 100 starting at 0. You role a die (or spin a wheel) and play against others doing the same. If you finish a turn at the base of a ladder, you go to the top. If you finish a turn at the top of a chute (slide) you go down to the bottom of the slide. Familiarize yourself with the [full rules](http://www.hasbro.com/common/documents/dad2614c1c4311ddbd0b0800200c9a66/43EA24525056900B105B53AC74279484.pdf).\n", 43 | "\n", 44 | "First, build a compact representation of the location of the location of the chutes and ladders using a Python dictionary.\n", 45 | "\n", 46 | "Next, create `Pawn` class that keeps track of the location of a player and simulates (using the `random` module) the Pawn movement. You should also create a `Game` class that keeps track of the game play as many Pawns move throughout the board. By calling a method of Game `.run()` a full Game is simulated.\n", 47 | "\n", 48 | "Make sure that the Pawn and Game classes keep statistics on the results, like how many moves were made, how many ladders and chutes were hit, which player wins etc.\n", 49 | "\n", 50 | "Simulate 1000 games with 2 players. Simulate 1000 games with 4 players." 51 | ] 52 | }, 53 | { 54 | "cell_type": "markdown", 55 | "metadata": {}, 56 | "source": [ 57 | "## Questions to Answer with your Simulation ##" 58 | ] 59 | }, 60 | { 61 | "cell_type": "markdown", 62 | "metadata": {}, 63 | "source": [ 64 | "1. What is the average number of turns a player must take before she gets to 100?\n", 65 | "\n", 66 | "2. What is the minimal number of turns in the simulation before getting to 100? What was the sequence of values in the spin in each turn? What was the longest number of turns?\n", 67 | "\n", 68 | "3. What is the ordering of first spins in a game that gives, on average, the quickest path to 100? What about the median?\n", 69 | "\n", 70 | "4. What is the probability that someone who goes first will win in a 2 and 4 person game?\n", 71 | "\n", 72 | "5. (optional) Ask another question of your simulation and answer it." 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "collapsed": false, 78 | "input": [], 79 | "language": "python", 80 | "metadata": {}, 81 | "outputs": [] 82 | } 83 | ], 84 | "metadata": {} 85 | } 86 | ] 87 | } -------------------------------------------------------------------------------- /Breakouts/Questions/OOP_I_Breakout_prob.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/Questions/OOP_I_Breakout_prob.pdf -------------------------------------------------------------------------------- /Breakouts/Questions/breakout2_question.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/Questions/breakout2_question.pdf -------------------------------------------------------------------------------- /Breakouts/Questions/funcs_and_mods_breakout.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/Questions/funcs_and_mods_breakout.pdf -------------------------------------------------------------------------------- /Breakouts/Questions/monday_homework1.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/Questions/monday_homework1.key -------------------------------------------------------------------------------- /Breakouts/Questions/monday_homework1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/Questions/monday_homework1.pdf -------------------------------------------------------------------------------- /Breakouts/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/profjsb/python-bootcamp/6495c2a83db60b8f1a2646826de55a427735a912/Breakouts/README -------------------------------------------------------------------------------- /Breakouts/Solutions/01_BasicTraining/breakout1.py: -------------------------------------------------------------------------------- 1 | ## solutions to the breakout #1 (Day 1) 2 | sent = "" 3 | while True: 4 | newword = raw_input("Please enter a word in the sentence (enter . ! or ? to end.): ") 5 | if newword == "." or newword == "?" or newword == "!": 6 | if len(sent) > 0: 7 | # get rid of the nasty space we added in 8 | sent = sent[:-1] 9 | sent += newword 10 | break 11 | 12 | sent += newword + " " 13 | print "...currently: " + sent 14 | print "--->" + sent 15 | ### created by Josh Bloom at UC Berkeley, 2010,2012 (ucbpythonclass+bootcamp@gmail.com) 16 | -------------------------------------------------------------------------------- /Breakouts/Solutions/02_AdvancedDataStructures/style.css: -------------------------------------------------------------------------------- 1 | 147 | -------------------------------------------------------------------------------- /Breakouts/Solutions/02_AdvancedDataStructures/talktools.py: -------------------------------------------------------------------------------- 1 | """Tools to style a talk.""" 2 | 3 | from IPython.display import HTML, display, YouTubeVideo 4 | 5 | def prefix(url): 6 | prefix = '' if url.startswith('http') else 'http://' 7 | return prefix + url 8 | 9 | 10 | def simple_link(url, name=None): 11 | name = url if name is None else name 12 | url = prefix(url) 13 | return '%s' % (url, name) 14 | 15 | 16 | def html_link(url, name=None): 17 | return HTML(simple_link(url, name)) 18 | 19 | 20 | # Utility functions 21 | def website(url, name=None, width=800, height=450): 22 | html = [] 23 | if name: 24 | html.extend([''] ) 27 | 28 | html.append('