Skip to content

Latest commit

 

History

History
104 lines (77 loc) · 5.49 KB

index.rst

File metadata and controls

104 lines (77 loc) · 5.49 KB

Programs, Information, and People

Learning with Python: Interactive Edition 2.0

Welcome! Take a tour, experiment with Python, join other readers in learning how to write programs in Python that analyze information produced by people, information such as the text they write, the comments and likes they make on Facebook, or the tags that they give to images on flickr.

As a task to start thinking about, suppose you were playing the game hangman. How do you choose which letters to guess? Perhaps you've heard that e is the most common letter in English, and that t is next. Those are reasonably good first guesses. After that, perhaps it's worth checking for vowels, since every English word has at least one vowel. There are lots of other tricks you might try. If you go all the way through this online textbook and all the exercises, eventually you will be able to write a program that makes good guesses in a related game, called the Shannon game. For now, let's just see how often certain letters appear in this introductory text.

.. activecode:: welcome
   :above:
   :autorun:
   :nocanvas:
   :hidecode:

   txt = """As a task to start thinking about, suppose you were playing the game hangman. How do you choose which letters to guess? Perhaps you've heard that e is the most common letter in English, and that t is next.
      Those are reasonably good first guesses. After that, perhaps it's worth checking for vowels, since every English word has at least one vowel. There are lots of other
      tricks you might try. If you go all the way through this online textbook and all the exercises, eventually you will be able to write a program that makes good guesses in
      a related game, called the Shannon game. For now, let's just see how often certain letters appear in this introductory text."""
   counts = {}
   for character in txt:
      if character in counts:
         counts[character] = counts[character] + 1
      else:
         counts[character] = 1

   for character in ["e", "t", "o", "u"]:
      print "The letter", character, "appears in the previous paragraph", counts[character], "times"


Benefits of this Interactive Textbook

  • You can experiment with activecode examples right in the book
    • Click Show/Hide Code button
    • On line 12: change u to n
    • Click the Run button
    • Change some of the text in the first few lines
    • Click the Run button again
  • You can do your homework right in the textbook.
  • Interactive questions make sure that you are on track and help you focus.
  • Codelens helps you develop a mental model of how Python works.
  • Audio Tours help you understand the code.
  • Short videos cover difficult or important topics.
  • You can highlight text, and take notes in scratch editors

Next Steps

About this Project

This interactive book is a product of the Runestone Interactive Project at Luther College, led by Brad Miller and David Ranum. There have been many contributors to the project. Our thanks especially to the following:

  • This book is based on the Original work by: Jeffrey Elkner, Allen B. Downey, and Chris Meyers
  • Activecode based on Skulpt
  • Codelens based on Online Python Tutor
  • Many contributions from the CSLearning4U research group at Georgia Tech.
  • ACM-SIGCSE for the special projects grant that funded our student Isaac Dontje Lindell for the summer of 2013.

The Runestone Interactive tools are open source and we encourage you to contact us, or grab a copy from GitHub if you would like to use them to write your own resources.

Contact

  • If you have questions about the content of this book, please send me email at presnick@umich.edu
  • If you have questions about the Runestone platform that allow the content to be interactive, please send me email bmiller@luther.edu
  • Check out the project on GitHub
  • Visit the project's Facebook page
.. toctree::
   :hidden:

   index
   navhelp