Skip to content

Commit 884b27c

Browse files
broke Python Pushups out to two pages -- coding bat now a separate page.
1 parent 428c448 commit 884b27c

File tree

3 files changed

+71
-21
lines changed

3 files changed

+71
-21
lines changed

source/exercises/codingbat.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. _codingbat:
2+
3+
#######################
4+
Practice with CodingBat
5+
#######################
6+
7+
8+
Puzzles
9+
=======
10+
11+
To get a bit of exercise solving some puzzles with Python, work on the Python
12+
exercises at "Coding Bat": http://codingbat.com/python
13+
14+
There are 8 sets of puzzles. Do as many as you can, but make sure to do at least three -- and all the "Warmups" would be a good goal.
15+
16+
While the CodingBat site has an interface for submitting your solution and see if it works, we suggest you write your code in your regular text editor and get it to run on your machine first.
17+
18+
If you are in a formal class, let the instructor know which ones you have done.
19+
20+
Remember this site -- it's a good idea to come back and play again with these little puzzles as you learn more Python. It's kind of like playing scales to keep fresh when learning a musical instrument.
21+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.. _exercise_file_processing:
2+
3+
###############
4+
File Processing
5+
###############
6+
7+
A bit of practice with reading and processing files.
8+
9+
10+
File reading and parsing
11+
========================
12+
13+
Download this text file:
14+
15+
:download:`students.txt <./students.txt>`
16+
17+
In it, you will find a list of names and what programming languages they have used in the past. This may be similar to a list generated at the beginning of this class.
18+
19+
Write a little script that reads that file and generates a list of all the languages that have been used.
20+
21+
What might be the best data structure to use to keep track of bunch of values (the languages) without duplication?
22+
23+
The file format:
24+
----------------
25+
26+
The first line of the file is:
27+
28+
``Name: Nickname, languages``
29+
30+
And each line looks something like this:
31+
32+
``Jagger, Michael: Mick, shell, python``
33+
34+
So a colon after the name, then the nickname, and then one or more languages.
35+
36+
However, like real data files, the file is NOT well-formed. Only some lines have nicknames, and other small differences, so you will need to write some code to make sure you get it all correct.
37+
38+
How can you tell the difference between a nickname and a language?
39+
40+
Extra challenge: keep track of how many students specified each language.
41+

source/exercises/python_pushups.rst

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Python Pushups
66

77
These are a couple exercises to kick you off with Python
88

9-
Task 1: Explore Errors
10-
======================
9+
Explore Errors
10+
==============
1111

1212
* Create a new directory in your working dir for the class::
1313

14-
$ mkdir lesson01
15-
$ cd lesson01
14+
$ mkdir pushups
15+
$ cd pushups
1616

1717
* Add a new file to it called ``break_me.py``
1818

@@ -22,24 +22,12 @@ Task 1: Explore Errors
2222

2323
* Each function should result in one of the four most common exceptions you'll find.
2424

25-
* for review: ``NameError``, ``TypeError``, ``SyntaxError``, ``AttributeError``
25+
* for review:
26+
- ``NameError``
27+
- ``TypeError``
28+
- ``SyntaxError``
29+
- ``AttributeError``
2630

2731
(hint -- the interpreter will quit when it hits a Exception -- so you can comment out all but the one you are testing at the moment)
2832

2933
* Use the Python standard library reference on `Built In Exceptions <https://docs.python.org/3/library/exceptions.html>`_ as a reference
30-
31-
32-
Task 2: Puzzles
33-
===============
34-
35-
To get a bit of exercise solving some puzzles with Python, work on the Python
36-
exercises at "Coding Bat": http://codingbat.com/python
37-
38-
There are 8 sets of puzzles. Do as many as you can, but try to get to at least
39-
the "Warmups".
40-
41-
While the codingbat site has a great interface for submitting your solution and see if it works, we suggest you write your code in your regular text editor and get it to run on your machine first.
42-
43-
Put at least one solution in the ``lesson1`` folder you created in git and submit it via pull request.
44-
45-

0 commit comments

Comments
 (0)