Git Product home page Git Product logo

py4e's Introduction

Python for Everybody (PY4E)

Course materials for www.py4e.com

The Python3 versions of the code is all in code3

If you are interested in the Python for Everybody book see the folders

See the file book3/README.md for more details.

Setup On Localhost

Here are the steps to set this up on localhost on a Macintosh using MAMP.

Install MAMP (or similar) using https://www.wa4e.com/install

Check out this repo into a top level folder in htdocs

cd /Applications/MAMP/htdocs
git clone https://github.com/csev/py4e.git

Go into the newly checked out folder and get a copy of Tsugi:

cd py4e
git clone https://github.com/csev/tsugi.git

Create a database in your SQL server:

CREATE DATABASE tsugi DEFAULT CHARACTER SET utf8;
CREATE USER 'ltiuser'@'localhost' IDENTIFIED BY 'ltipassword';
GRANT ALL ON tsugi.* TO 'ltiuser'@'localhost';
CREATE USER 'ltiuser'@'127.0.0.1' IDENTIFIED BY 'ltipassword';
GRANT ALL ON tsugi.* TO 'ltiuser'@'127.0.0.1';

Still in the tsugi folder set up config.php:

cp config-dist.php config.php

Edit the config.php file, scroll through and set up all the variables. As you scroll through the file some of the following values are the values I use on my MAMP:

$wwwroot = 'http://localhost:8888/py4e/tsugi';   // Embedded Tsugi localhost

...

$CFG->pdo = 'mysql:host=127.0.0.1;port=8889;dbname=tsugi'; // MAMP
$CFG->dbuser    = 'ltiuser';
$CFG->dbpass    = 'ltipassword';

...

$CFG->adminpw = 'short';

...

$CFG->apphome = 'http://localhost:8888/py4e';
$CFG->context_title = "Python for Everybody";
$CFG->lessons = $CFG->dirroot.'/../lessons.json';

... 

$CFG->tool_folders = array("admin", "../tools", "../mod");
$CFG->install_folder = $CFG->dirroot.'./../mod'; // Tsugi as a store

...

$CFG->servicename = 'PY4E';

(Optional) If you want to use Google Login, go to https://console.developers.google.com/apis/credentials and create an "OAuth Client ID". Make it a "Web Application", give it a name, put the following into "Authorized JavaScript Origins":

    http://localhost

And these into Authorized redirect URIs:

http://localhost/py4e/tsugi/login.php
http://localhost/py4e/tsugi/login

Note: You do not need port numbers for either of these values in your Google configuration.

Google will give you a 'client ID' and 'client secret', add them to config.php as follows:

$CFG->google_client_id = '96..snip..oogleusercontent.com';
$CFG->google_client_secret = 'R6..snip..29a';

While you are there, you could "Create credentials", select "API key", and name the key "My Google MAP API Key" and put the API key into config.php like the following:

$CFG->google_map_api_key = 'AIza..snip..9e8';

Starting the Application

After the above configuration is done, navigate to your application:

http://localhost:8888/py4e/tsugi/

It should complain that you have not created tables and suggest you use the Admin console to do that:

http://localhost:8888/py4e/tsugi/admin

It will demand the $CFG->adminpw from config.php (above) before unlocking the admin console. Run the "Upgrade Database" option and it should create lots of tables in the database and the red warning message about bad database, should go away.

Alternately, you can create all the databases on the command line using:

cd py4e/tsugi/admin
php upgrade.php

Keep refreshing the /py4e/tsugi page until all the error messages go away. Once the error messages are gone, the main page should also have no errors.

http://localhost:8888/py4e/

Go into the database and the lti_key table, find the row with the key_key of google.com and put a value in the secret column - anything will do - just don't leave it empty or the internal LTI tools will not launch.

Next use the administrator interface to install the peer-grading tool from the github repository:

http://localhost:8888/py4e/tsugi/admin/install

Click on "Available Modules" and install https://github.com/tsugitools/peer-grade - you will need to re-run the database upgrade process to create the peer-grader tables.

Then install the "Gift Quiz" tool and re-run the database upgrade.

If you want to have access to the quiz content, please contact Chuck for access to the private py4e repository. Access will only be given to those seriously installing the software and verified as teaching the course and adopting the materials. To checkout the private repo:

cd py4e
git clone https://github.com/csev/py4e-private.git

Then add the following line to your config.php:

$CFG->giftquizzes = $CFG->dirroot.'/../py4e-private/quiz';

At this point, you will need the "quiz unlock password" (also from Chuck) and at that point, you should be able to launch and load all the quizzes (one at a time) from the repository. You need to load the quiz content for every course (context) separately. But at least you don't have to type them all in.

The other two LTI tools that are required are already part of the py4e repo and in py4e/tools folder.

You can always test the tools using the "App Store" at:

http://localhost:8888/py4e/tools/

This allows you to do test launches as the instructor and student in a test environment using the key '12345'.

Using the Application

Navigate to:

http://localhost:8888/py4e/

You should click around without logging in and see if things work.

Then log in with your Google account and the UI should change. In particular you should see 'Assignments' and in Lessons you should start seeing LTI autograders.

Becoming Instructor in the Global Course

Tsugi can support using the content in a Learning Management system through LTI launches and LTI Keys.

You can also run a "MOOC" where students directly log in using Google to your site and do the homework, track their grades, and earn badges.

You will want to "promote" your student account to a teacher account as follows.

  • Log in with your Google account

  • Go to /tsugi/admin - Note that you won't see the Admin option in your drop down until you visit it once and successfully log in to the Admin UI.

  • Enter the admin password you chose in config.php to log into Admin.

  • In the Administration Console, choose View Contexts - These are the "courses" - if you just set things up there will be just one course. Otherwise find the course that matches your configured context_name and go into it.

  • Find your account in the membership records. You can search using your gmail address if there are a lot. Go into your membership record.

  • Edit your membership record and change your "Role Override" value to 1000 and save your record.

Poof! You (and as many of the other folks you give this power to) are now the "instructors" of the global class.

Becoming Instructor for an LTI-Launched Course when the LMS Does not support the Instructor Role

Some LMS systems do not send the Instructor role "the way you would like it to". Sometimes it never sends the instructor role and in other cases it does not send the instructor role for teaching assistants or perhaps you want to promote some students into teaching assistants.

It is pretty simple to do this in Tsugi.

  • Log in to /tsugi/admin as in the previous instructions.

  • Find the context that corresponds to your LTI-Launched course. Enter the context.

  • Find the membership record (often searching on email address) and then edit the membership record, setting "Role Override" to 1000 and saving the membership record.

From that point forward regardless of the role sent by the LMS - that user will be seen as an instructor by Tsugi.

py4e's People

Contributors

adam662006 avatar alistairwalsh avatar antonioestela avatar arbalister avatar captainvim avatar ckolos avatar cristiklein avatar csev avatar eah13 avatar eternalfootman avatar ghfudemytraining avatar hamoon-n1 avatar jiakuanghe avatar jtspinks avatar konkiourtidou avatar kumarnt100 avatar leerssej avatar lucytallents avatar markjcp avatar mikepfunk28 avatar mstremeski avatar nabaruns avatar nivesnine avatar ntkumar avatar orbicularis avatar saildata avatar sanjayrao77 avatar skan12345 avatar srcatto avatar yihuajack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py4e's Issues

Small typo in Chapter 13?

Comment applies to https://www.py4e.com/html3/13-web

In the sentence, "It is important to include all parent level elements in the findall statement expect for the top level element (e.g., users/user). Otherwise, Python will not find any desired nodes." I think "except" might be what you meant rather than "expect".

Explicit Closing of Files

First off, I want to thank you for making this content freely accessible. I came to this site through Python for Everyone, and it is very helpful to have a text for the courses.

I have been reading through this version of the text as well as the Python 2 version and I noticed that in word.py , then in Chapter 7 and other examples in the book, the files that are opened in the programs are not explicitly closed. The only place where I saw close mentioned was in order to save a write to a file.

In reading from other sources and from instruction in a Bioinformatics course that I took, it was suggested that as a best practice, you should always explicitly close any files opened by your program, whether or not they were written to, to avoid corruption or inadvertent change.

I am not sure how much of an issue this is, but I wanted to raise it in case it is something that might benefit other learners starting out to get into the habit of writing programs that clean up after themselves when they make file and data calls.

Autograder: Exercise 5.2

it is written: " Enter 7, 2, bob, 10, and 4"
you could write: " Enter 7, 2, bob, 10, 4 and done"

HTML build for class?

This is more of a convenience thing, but would it be possible to add an HTML version to the build server? I'd like my students to be able to get the latest versions of chapters without re-downloading an epub.

Or, even better, can I get permission to set up a build server for my class that builds the latest into an HTML version? I could password-protect it or make sure via the robots.txt it won't get indexed. If we go with this option I can start experimenting with interactive Trinket code blocks for the book

Oauth & twitter examples direction?

We'll need a benevolent dictator (@csev) edict on this one I think. oauth.py is abandoned and it seems like editing it directly is ill-advised. There is a successor but I haven't dug in to see how similar the API is. Also, it's not a single file, so perhaps more confusing to include in the folder and have users import locally.

Backing up, how should the twitter examples be revised? There are some twitter-specific modules out there but they may be too high level for the chapter's goals. Rewriting them to use oauth2 seems like a good way forward but just wanted to check before heading down that road. Some of the changes may be extensive (since Twitter also revised its API in the meantime) and may demand text tweaks.

Typo Chapter 12 Networked Programs

There are two typos in the HTML book https://www.py4e.com/html3/12-network
They are located in the title and the third sentence.

  1. HyperText Transfer Protocol - HTTP
    The first "t" should be lowercase:
    Hypertext Transfer Protocol - HTTP
    https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

  2. In the sentence, "The network protocol that powers the web is actually quite simple and there is built-in support in Python called sockets..." sockets should be socket.
    This is how it is mentioned in the reference.
    https://docs.python.org/3.7/library/socket.html

bug on # Code: http://www.py4e.com/code3/urlregex.py

Hi, I am MinSeok who is a newbie of Python..

I found one bug on code3/urlregex.py, so I am reporting below.
There were making ctx object but it would never use it later.
So this source code won't work because of error on urlopen() function to try to cconnect https without ctx of ssl.
So, Code will have to modify like below to work well.

-- Before
html = urllib.request.urlopen(url).read()

-- After
html = urllib.request.urlopen(url, context=ctx).read()

I am sorry for paying your attention of this issue, If someone already reported it.

I hope it will help you make your nice Python textbook and videos.
Sincerely,
MinSeok.

Code conversion checklist

This is an initial list of what's working with & without errors. The more complicated files (those in subdirectories, those that use sqlite dbs, twitter, etc) deserve a second look, executing the code in a specific order.

  • ./argfile.py
  • ./argtest.py
  • ./avelist.py
  • ./avenum.py
  • ./average.py
  • ./celsius.py
  • ./copytildone.py
  • ./count1.py
  • ./count2.py
  • ./count3.py
  • ./curl1.py
  • ./curl2.py
  • ./curl3.py
  • ./db1.py
  • ./db2.py
  • ./egg.py
  • ./emaildb.py
  • ./fahren.py
  • ./geodata/geodump.py
  • ./geodata/geoload.py # NameError: name 'buffer' is not defined
  • ./geojson.py
  • ./geoxml.py # program doesnt terminate but is fine
  • ./gmane/gbasic.py
  • ./gmane/gline.py
  • ./gmane/gmane.py # needs bytes conversion
  • ./gmane/gmodel.py
  • ./gmane/gword.py
  • ./gmane/gyear.py
  • ./grade.py
  • x ./graphics/graphics.py # TODO; I'm headless
  • x ./graphics/histogram.py # TODO; I'm headless. also TabError: inconsistent use of tabs and spaces in indentation
  • ./greet.py
  • ./grep.py
  • ./hidden.py
  • ./json1.py
  • ./json2.py
  • ./largest.py
  • ./mailcount.py
  • ./mailtop.py
  • ./oauth.py # This will need to be updated- uses depricated sha
  • ./open.py
  • ./pagerank/BeautifulSoup.py # Needs latest version ImportError: No module named 'sgmllib'
  • ./pagerank/spdump.py
  • ./pagerank/spider.py # Needs beautiful soup bump & check
  • ./pagerank/spjson.py
  • ./pagerank/sprank.py
  • ./pagerank/spreset.py
  • ./pals.py
  • ./pay.py
  • ./pay2.py
  • ./pay3.py
  • x ./pythonweb/webserver.py # SyntaxError: Missing parentheses in call to 'print'
  • ./re01.py
  • ./re02.py
  • ./re03.py
  • ./re04.py
  • ./re05.py
  • ./re06.py
  • ./re07.py
  • ./re08.py
  • ./re09.py
  • ./re10.py
  • ./re11.py
  • ./re12.py
  • ./re13.py
  • ./re14.py
  • ./roster/roster.py # NameError: name 'roster_data' is not defined
  • ./search1.py
  • ./search10.py
  • ./search2.py
  • ./search3.py
  • ./search4.py
  • ./search5.py
  • ./search6.py
  • ./search7.py
  • ./search8.py
  • ./search9.py
  • ./sequence.py
  • ./socket1.py
  • ./socket2.py
  • ./soft.py
  • ./spamave.py
  • ./tracks/tracks.py
  • ./twdump.py # The twitter examples need an oauth bump, maybe more
  • ./twfriends.py # Also plenty of Also TypeError: key: expected bytes or bytearray, but got 'str'
  • ./twitter1.py
  • ./twitter2.py
  • ./twjoin.py
  • ./twspider.py
  • ./twtest.py
  • ./twurl.py
  • ./txtcheck.py
  • ./txtcheck2.py
  • ./txtcheck3.py
  • ./txtcount.py
  • ./txtdelete.py
  • ./txtmd5.py
  • ./txtsize.py
  • ./urljpeg.py
  • ./urllib1.py
  • ./urllib2.py
  • ./urllink2.py # bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
  • ./urllink3.py
  • ./urllinks.py
  • ./urlregex.py
  • ./urlwords.py
  • ./whathour.py
  • ./wikigrade.py
  • ./wordlist.py
  • ./words.py
  • ./xml1.py
  • ./xml2.py

AttributeError: module 'oauth' has no attribute 'OAuthConsumer

Upon running sample code twitter1.py and it fails on this error:

$ python3 twitter1.py

Enter Twitter Account:mytwitter
Traceback (most recent call last):
File "twitter1.py", line 20, in
{'screen_name': acct, 'count': '2'})
File "/Users/xxxxph/PycharmProjects/xxxxPy/twurl.py", line 10, in augment
consumer = oauth.OAuthConsumer(secrets['consumer_key'],secrets['consumer_secret'])
AttributeError: module 'oauth' has no attribute 'OAuthConsumer

any suggestions, the same error occurs if I try with oauth2

book3/json2.py suggestion

I assume the data should mimic the one in xml2.py, so the suggestion is for the 2nd item, make the name tag "Brent"

Todos/milestones?

I should be able to lend a hand with the conversion. Looking at the repo and commit history, it's not immediately apparent what needs attention. The TODO file gives a decent overview of what needs to be done but not, for instance, which files have been checked already and which still have issues.

Everyone's got their own product management prefs. @csev: you're the guru for this repo. Prefs?

I've seen checklist issues work for smaller stuff. For example:

  • This is a filename that needs conversion
  • This is a filename that is done.

The downside is they must be manually checked off by a committer.

I've also seen one issue per todo work. A nice thing is that the issues can then be closed via the PR they address. Also, they are very easy for contributors to pick up and knock out.

Happy to chat synchronously if that's helpful. Once some work is scoped I should be able to contribute every few days as I prep my course.

Book markup issue Chap 8 Lists debugging

Don't know the Markup required to fix, it looks like it should highlight the code as Python.
https://py4e.com/html3/08-lists

Debugging
1.

It is tempting to write list code like this: ~~ {.python} t = t.sort() # WRONG! ~~

The markup looks the same as the other code snippets when editing
py4e/edit/master/book3/08-lists.mkd

Code error in Chapter 7 (search.py)

A student of mine found a erroneous code sample in Chapter 7 - both in the html and the associated .py file. (https://www.py4e.com/code3/search7.py)

Here is what it says in the code:

fname = input('Enter the file name: ')
try:
    fhand = open(fname)
except:
    print('File cannot be opened:', fname)
    exit()
count = 0
for line in fhand:
    if line.startswith('Subject:'):
        count = count + 1
print('There were', count, 'subject lines in', fname)

-The problem with this is: if the file name is wrong or the file cannot be read (i.e., the code block in try fails and it goes to except), it still tries to do the remaining operations (reading the file in the for loop) and throws an error. The exit() somehow did not work. That whole part should have been in the try block itself. It was okay for us, as the student could ask me, but I guess for people learning on their own, this could confuse them. Please edit this.

Paginated HTML view

Just discovered this and thought I'd drop a link for consideration. Haven't dug in too deeply but seems like this would give a slick paginated feel to the epub and make it readable without installing a reader https://github.com/joseph/Monocle

Quick example of what o book looks like in it: http://monocle.inventivelabs.com.au/books/dubliners

Also seems possible that trinket embeds and any other HTML would work in this view.

(found during my search for a good Chrome epub reader)

code regression suite

As time advances, newer versions of python will be released. It's nice to know that the behavior of the code samples or assignments doesn't change or if it does, it can be quickly isolated and fixed.
Maybe this is overkill, what do you think?

.gitignore x.pdf, x.epub?

I was a little sloppy with some commits and the pdf and epub made it in. I'm happy to fix conflicts I cause but wondering if it might be a good idea to gitignore them since they're build products?

Three dot what? (Python versions)

Some of the materials for this book reference Python 3.0. I think there's one too many significant figures in there. It'd be more correct to say "Python 3"; Python 3.0 has been obsolete since the release of Python 3.1 on June 27th, 2009 :)

For the official supported subversion of the language, I think it'd be best to pick a recommended subversion such as 3.4 or 3.5 and note it in the preface or introduction. "Will work with Python 3.X or later" or etc. We may be compatible with Python 3.0 but someone should probably[1] go through in a venv and check. Major versions are (theoretically) backwards compatible so whatever the subversion is we should be good for all future 3.Xs. bs4 or some other third party module is likely to be the limiting factor on this- they often like to use the latest.

[1] - "someone should probably" means "I'll do this eventually if no one else does, but I hope someone else does"

book3/16-viz.mkd

"The first five locations are already in the database and so they are skipped."
=>
"The first six locations are already in the database and so they are skipped."

python 2 syntax in book3 ch2

Cannot push a fix branch to the repo, the diff:

--- a/book3/02-variables.mkd
+++ b/book3/02-variables.mkd
@@ -649,7 +649,7 @@ at you:

 for word in words:
-    print word
+    print(word)
 

Tiny spelling mistake or not?

Exercises
Exercise 2: Write a program that categorizes each mail message by which day of the week the commit was done. To do this look for lines that start with "From", then look for the third word and keep a running count of each of the days of the week. At the end of the program print out the contents of your dictionary (order does not matter).

should be comment?

Ch 10: Tuple assignment. the variable m in the examples is actually a list

In the 'Tuple Assignment' section of Chapter 10 there are 3 code examples where the example shows operations on a list rather than a tuple.

First:

>>> m = [ 'have', 'fun' ]
>>> x, y = m
>>> x
'have'
>>> y
'fun'
>>>

should be:
>>> m = ( 'have', 'fun' )
>>> x, y = m
>>> x
'have'
>>> y
'fun'
>>>

Second:

>>> m = [ 'have', 'fun' ]
>>> x = m[0]
>>> y = m[1]
>>> x
' have'
>>> y
'fun'
>>>

should be:
>>> m = [ 'have', 'fun' ]
>>> x = m[0]
>>> y = m[1]
>>> x
' have'
>>> y
'fun'
>>>

Third(and last):

>>> m = [ 'have', 'fun' ]
>>> (x, y) = m
>>> x
'have'
>>> y
'fun'
>>>

should probably be:
>>> m = [ 'have', 'fun' ]
>>> (x, y) = m
>>> x
'have'
>>> y
'fun'
>>>

I say probably because technically this does show use of a tuple in an assignment, but I suspect the intent was to show a tuple on both sides of the assignment operator.

Convert code blocks to VerbatimInput

As described in #63, we can automatically include the text of code3 files in the text of the book using \VerbatimInput{<filename>}. This now needs to happen for each chapter.

  • Chapter 1
  • Chapter 2
  • Chapter 3
  • Chapter 4
  • Chapter 5
  • Chapter 6
  • Chapter 7
  • Chapter 8
  • Chapter 9
  • Chapter 10
  • Chapter 11
  • Chapter 12
  • Chapter 13
  • Chapter 14
  • Chapter 15

book3, ch10 simplification suggestion

Under: Multiple assignment with dictionaries

Can drop the "list" in:
for key, val in list(d.items()):
print(val, key)

suggested form:
for key, val in d.items():
print(val, key)

Party5.py code in ch14 outputs wrong

Dear Prof Sev,

The code in party5.py on the Chapter 14 page initiates 'Sally' and 'Jim' but then shows the code as printing out Sally, then Sally-Party, then Jim and Jim-party.

According to the code, Sally and Jim should initiate first, but according the the box that shows the output, Sally initiates, then parties, then Jim initiates, then Jim parties.
screen shot 2019-01-04 at 1 35 10 pm

Proofreading checklist

Things I've encountered as one-offs that I'll Ctrl-f for in all chapters:

  • remove all u'unicode strings' since Python 3 is unicode by default (esp chapter 14)
  • make sure all markdown links have http:// in the URL
  • explain u' vs b' in Python 2 & 3 at the appropriate points. The python docs have a great explanation of urllib here:

Note that urlopen returns a bytes object. This is because there is no way for urlopen to automatically determine the encoding of the byte stream it receives from the http server. In general, a program will decode the returned bytes object to string once it determines or guesses the appropriate encoding.

  • Bad hyphens and any other character problems. Just saw this bad hyphen in chapter 12:

screenshot 2016-02-14 at 9 19 17 pm

There may be other problem characters. Once they're found it's an easy job to go replace them with the right char.

Chapter numbers?

Should intro be Ch 0 or Ch 1? If 0, can I rename the files to match? Trying to avoid confusion.

Exercise numbering

Several chapters have exercise numbering that's off.

Edit: This would be a quick fix for a new contributor to tackle! Ctrl-F for Exercise and make sure they count up correctly.

  • Chapter 1
  • Chapter 2
  • Chapter 3
  • Chapter 4
  • Chapter 5
  • Chapter 6
  • Chapter 7
  • Chapter 8
  • Chapter 9
  • Chapter 10
  • Chapter 11
  • Chapter 12
  • Chapter 13
  • Chapter 14
  • Chapter 15

Chapter 01 -sample code.

Sorry, There is something that went wrong with your code in the program that checks the unique word and count their total number of frequency they appear.

You have written:
name = input('Enter file:')

I think it should be
name = input(print('Enter file:'))

Thanks for your support.

Small typos in chapter 2 of book3

word *in* words*:*\ *print* word
perhaps should be
*for* word *in* words*:*\ *print* word

In Exercise 4
1 + 2 \* 5
The * is escaped and perhaps should just be
1 + 2 * 5

Tests?

I've started using Travis CI for my class website and it's pretty great. Wondering if tests for this repo would be a good idea? Would ensure that PRs don't break builds. Downside: Waiting a few minutes when a PR gets submitted to see if it passes.

Initially it could just check that book.sh builds with no errors but eventually could check the html version, website, etc. https://github.com/gjtorikian/html-proofer or something similar could check for dead links, etc.

Styling guide

Is there an official styling guide?

Seeing as the book is aimed at beginners, I would like the code samples to be as clear and beginner-friendly as possible.

Specifically, I would like to change all one liners such as:
if re.search(search, line): count = count + 1
into

if re.search(search, line):
    count = count + 1

Any thoughts?

Redraw all of the figures in OmniGraffle - Checklist

This will take the figures from book/figs2 and redraw them in omnigraffle and put the omnigraffle files in figures and the SVG / EPS files in the folder images. There is already a pda figure that has been converted.

  • Chapter 1
  • Chapter 2
  • Chapter 3
  • Chapter 4
  • Chapter 5
  • Chapter 6
  • Chapter 7
  • Chapter 8
  • Chapter 9
  • Chapter 10
  • Chapter 11
  • Chapter 12
  • Chapter 13
  • Chapter 14
  • Chapter 15

Filenames for included code

For \VerbatimInput blocks it would be spiffy to have the filename listed above the code somehow for easy reference.

Cover .format string method

the .format method is replacing the % operator, which will eventually be deprecated. Python 3 supports both, so we should cover both in Chapter 6.

I'll try to add this in the next few weeks if I can - teaching a summer course.

Syntax highlighting and fenced code blocks

Adding ~~~~ {.python} and ~~~~ {.python trinket} (Edit: typo; it needs to be ~~~~ {.python .trinket}) to code blocks to invoke pandoc's built-in syntax highlighting and allow optional trinketization in the HTML output. The trinket (and anything else in the braces) is either ignored or added as a class in HTML output, meaning non-trinketized versions will be unaffected. My scripts use it to know when code blocks can/should be made interactive vs. when they're a fragment that should only be highlighted.

I'm also converting indent-based code blocks to fenced for completeness though it of course won't affect the output.

Documenting progress here:

  • Chapter 1
  • Chapter 2
  • Chapter 3
  • Chapter 4
  • Chapter 5
  • Chapter 6
  • Chapter 7
  • Chapter 8
  • Chapter 9
  • Chapter 10
  • Chapter 11
  • Chapter 12
  • Chapter 13
  • Chapter 14
  • Chapter 15

Typo in Chapter 10 footnote

The start of Chapter 10 - Tuples has a "Fun fact" footnote:

A tuple^[Fun fact: The word "tuple" comes from the names given to sequences of numbers of varying lengths: single, double, triple, quadruple, quituple, sextuple, septuple, etc.]

Here quituple should be quintuple.

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.