From 7935b6916c21ce4187be7cdc82ccb97cf335ea68 Mon Sep 17 00:00:00 2001 From: Spencer Lyon Date: Tue, 20 Sep 2016 13:30:13 -0400 Subject: [PATCH] fix some wording + styling in pyfun2 --- py-fun2.md | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/py-fun2.md b/py-fun2.md index 9019f49..16a116a 100644 --- a/py-fun2.md +++ b/py-fun2.md @@ -272,14 +272,14 @@ We can also count backward, but again Python has its own numbering convention. Let's track this "backward" numbering system in our example. Below the "counting forward" numbers, start another row. Below the letter `e` write -1. As we move to the left, we type, -2, -3, -4. Label this row "counting backward." -**Exercise.** Take the string `firstname = 'Monty'` and write below it the forward and backward counting conventions. What is the third letter (`n`) in each system? +**Exercise.** Take the string `firstname = 'Monty'` and write below it the forward and backward counting conventions. What integer would you put in square brackets to extract the third letter (`n`) under each system? **Exercise.** Find the last letter of the string `lastname = 'Python'`. Find the second to last letter using both the forward and backward counting conventions. We can do the same thing with lists, but the items here are the elements of a list rather than the characters in a string. The counting works the same way. Let's see if we can teach ourselves. -**Exercise.** Take the list `numberlist = [1, 5, -3]`. Use slicing to set a variable `first` equal to the first item. Set another variable `last` equal to the last item. Set a third variable `middle` equal to the middle item. +**Exercise.** Take the list `numberlist = [1, 5, -3]`. Use slicing to set a variable `first` equal to the first item. Set another variable `last` equal to the last item. Set a third variable named `middle` equal to the middle item. ## More slicing @@ -401,7 +401,7 @@ for letter in word: * Write a program that prints the elements of `stuff`. * Write a program that tells us the `type` of each element of `stuff`. -* *Challenging.* Write a program that goes through the elements of `stuff` and prints only the elements that are strings; that is, the function `type` returns the value `str`. +* *Challenging.* Write a program that goes through the elements of `stuff` and prints only the elements that are strings; that is, the print the elements where function `type` returns the value `str`.