Git Product home page Git Product logo

Comments (6)

ribernhard avatar ribernhard commented on August 11, 2024

Barring any major package conflicts, plan to use 3. Need to go through and update ipython notebook and markdown files accordingly. Double-check all packages! Make another file listing all packages used in course so we can keep track of issues with later updates/versions.

from ps239t.

ribernhard avatar ribernhard commented on August 11, 2024

Remember to change the installation instructions too!

from ps239t.

ribernhard avatar ribernhard commented on August 11, 2024

Rochelle will send notes on how to easily update from 2 to 3!

from ps239t.

rochelleterman avatar rochelleterman commented on August 11, 2024

To create a python 3 environment, use the commands outlined here

In brief:
Open up a terminal. You can be anywhere for this to work. The first time you do this, you need to create a python 3 environment (here it's called "py3k"):

$ conda create -n py3k python=3 anaconda

Then you activate that environment by typing
$ source activate py3k

At that point you should now see an indication that you are in py3k. At which point you can spin up an ipython notebook and it will use a python 3 kernel. You can also cd into wherever or do any of your bash things. Python 3 will be used until you end the environment or close the terminal window.

from ps239t.

rochelleterman avatar rochelleterman commented on August 11, 2024

Note that the 03_python-basics/madlib.py script will break in Python 3.

from ps239t.

rochelleterman avatar rochelleterman commented on August 11, 2024

Here's the edited madlib.py for Python 3

"""
String Substitution for a Mad Lib
Adapted from code by Kirby Urner
"""                                                  

story = """                                       
Once upon a time, deep in an ancient jungle,
there lived a %(animal)s.  This %(animal)s
liked to eat %(food)s, but the jungle had
very little %(food)s to offer.  One day, an
explorer found the %(animal)s and discovered
it liked %(food)s.  The explorer took the
%(animal)s back to %(city)s, where it could
eat as much %(food)s as it wanted.  However,
the %(animal)s became homesick, so the
explorer brought it back to the jungle,
leaving a large supply of %(food)s.

The End
"""                                                 

def tellStory():                                     
    userPicks = dict()                              
    addPick('animal', userPicks)            
    addPick('food', userPicks)            
    addPick('city', userPicks)            
    print(story % userPicks)                        

def addPick(cue, dictionary):
    prompt = "Enter a specific example for %s: " % cue     
    dictionary[cue] = input(prompt)                                                             

tellStory()                                         
input("Press Enter to end the program.")        


from ps239t.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.