davewadestein / ADI-Reskilling-Academy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins server URL:

Week 5 survey link

https://www.surveymonkey.com/r/ADI_Week5_DWS

How to reach me (or others)

My email: dave@developintelligence.com

Slack channel: sw-reskill-class2 (search for this channel in the global options)

Slack URL: https://analog.enterprise.slack.com/

Sabrina Devitt (sabrina@developintelligence.com)

How to follow along...

In the cloud...

or locally on your machine...

  • do this:

  • or this:

    • install Anaconda (600+ MB) (https://www.anaconda.com/)
      • download and install (right-click and elevate permissions)
      • choose the defaults
      • Jupyter will be in your Start Menu
      • Anaconda Navigator is in the Start Menu but you need to "pin it" if you want it over and over...
      • JupyterLab is the equivalent of Binder up the in cloud
    • troubleshooting Anaconda
      • if JupyterLab will not open, note this from Kevin Goodspeed:

        To Launch JupyterLab from Anaconda requires Running as Administrator or Run Elevated. I got the same error, and solved it by going to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit), right-clicking on 'Anaconda Navigator (Anaconda3)' and selecting Run as Administrator.

        • Matt added this clarification–if you are running "elevated" you simply need to enter your password, but if you are running as administrator, you have to enter your username, which is different from your email address.
  • or if you are a glutton for punishment, do this:

    • install Python (www.python.org) + install Jupyter
    • on Windows, probably pip install jupyterlab from a DOS/command window
  • stop here for now

  • once Python is installed you need to install pytest

    • at a command prompt, do these things:
      • type pip install pytest
      • (you may see a warning at the end if the install suggesting you add a folder to your PATH)
      • you should add that folder to the path by hitting the Windows key and typing env into your Windows search bar
      • once you've added to the path, reboot your computer
      • then go to command window and type where pytest and it should respond with a folder rather than a error
      • at that point you should be able to create a new folder into which you'll end up putting Python code, and once inside that folder, even if it's empty, you shoud be able to run pytest
      • if any problems, ask...

Useful Python resources

Local git setup

Git resources on the web

Git on Pluralsight

  • Paolo Perrotta

Installing Jupyter and Python locally

  • some troubleshooting notes re: installing on Windows courtesy of former students:
  1. First ensure that your windows machine has a copy of Python. I got mine right from the Microsoft Store.

  2. From here you need only to run the following code within the command line (windows+R cmd) to install

    			pip install jupyterlab
    
  3. According to Jupyter Lab, to run the program after the installation you run the following code from command line (this did not work for me...)

    			jupyter-lab
    			
    				or
    				
    			python -m notebook
    
  4. If step 2 did not work for you, verify that the python.exe file is a user variable. Run the following code in command line and copy the PATH that is output

    			where.exe python
    
  5. Press the windows key and enter "environment variables". From the "Advanced" tab within the "System Properties" window, click "Environment Variables"

  6. From the new "Environment Variables" window, click the New user variable button and enter the following. Be sure to click "OK" when closing windows after entering info

    			Variable Name: python
    

Project Manager: sabrina@developintelligence.com

  • reach out to her for any concerns/issues/recordings

What tools/skills do I need to be a good programmer?

  • good problems-solving skills
    • ability to break things into smaller pieces
    • methodical / attention to detail
  • perseverance
  • not math sense, per se
  • common errors to be aware of: off-by-one
    • the three banes of existence for programmers are: uninitialized variables and off-by-one errors

Books you may want to consider

  • Introducing Python by Bill Lubanovic (beginner)
  • Fluent Python by Luciano Ramalho (intermediate)

TDD Testing Tools ...

Linux–how to run it on your machine or in the cloud

"Group" programming assignment

  1. add a "store game" feature to Chutes and Ladders
  • when you quit, you have the option to save the game

    • save whose turn it is and the player names and positions
    • player whose turn it is is first line
    • subsequent lines are player and position, e.g.,

    Grace
    Dave 55
    Carlos 41
    Grace 65

    • you might consider a special extension (other than .txt), e.g., .chute
  • when you start the game, you may choose to enter a filename with content such as the above

    • if contents are valid, restore the game and continue
    • if not valid, tell user!
      • Simon's suggestion: some code or word or phrase like "chutes_and_ladder_stored_games" at the top
  • e.g., Cows and Bulls

    • what to store?
      • secret code
      • guesses so far / responses (or recreate them)
      • Balbir suggestion: store the guesses and the responses together in a dict
    • what to change in this program?
      • how many digits in the code? (if we didn't ask that, add it) / maybe have the restore function here
      • when you quit, perhas 'q' for 'quit' and 's' for 'save'
    • how to do this?
      • functions!
      • test them
  1. Make some new functions for some of the main program code
  2. let a player quit independent of the game
  3. let a new player take over for an existing player
  4. etc.

2nd "Group" Project Options

  • The Monty Hall Problem
    • https://en.wikipedia.org/wiki/Monty_Hall_problem
    • The goal is to simulate it. In other words, pick a random door behind which the “car” is hidden, then pick a random door that represents the choice made by the contestant, then have the contestant switch to the other door. Ask how many times to run this simulation and you should see it converging on a 66.67% probability that the contestant wins the car by switching. These are the only two possible scenarios:
      1. contestant picks car on first try, Monty Hall reveals a goat behind one of the remaining doors, contestant switches to final remaining door, and loses
      2. contestant does not pick car on first try, Monty Hall reveals a goat behind one of the remaining doors, contestant switches to final remaining door, and wins
    • Your simulation should show that #1 happens 1/3 of the time (because with 3 doors, there is a 1/3 chance of picking the car on the first choice), and that #2 happens 2/3 of the time.
    • Let the user enter the number of doors, so as the number of doors increases, the benefit from switching increases. As an example, consider how it would work with 100 doors. Contest picks a door, Monty Hall shows the contestant that nothing of value is behind 98 of the other doors, and then asks if contestant wants to stick with original choice or switch to the one remaining door. In this example, the contestant clearly had a 1/100 chance of getting car on first try, but if contestant switches, there is a 99/100 chance the car will be behind the remaining door. So your simulation should show that with 100 doors, the benefit from switching occurs 99% of the time.
  • Roshambo / Rock-Scissors-Paper
    • play against the computer
    • you pick one of Rock / Scissors / Paper
    • computer picks one
    • compare
      • paper cover rocks (paper wins)
      • rock smashes scissors (rock wins)
      • scissors cuts paper (scissors wins)

Blackjack

  • computer deals 2 cards to each player
  • the rank of the cards is all that matter, suits are ignored
  • J, Q, K count as 10
  • A counts as 1 or 11 (don't worry about this at first)
  • the value of a hand is the total of all the cards, e.g., 4 and K total 14, A and 5 total 16 (or 6)
  • player can "hit" (ask for another card) or "stand"
  • dealer must hit on a hand below 17 and stand on 17+
  • player with higher hand wins
  • 21 is a "blackjack"
  • hands over 21 are a "bust" and the other player wins
  • you can get Unicode suit symbols like this: suits = '\u2663 \u2662 \u2661 \u2660'.split()

About


Languages

Language:Jupyter Notebook 88.0%Language:Python 11.7%Language:Shell 0.3%