Another Blog Quiz

flickr photo by shared under a Creative Commons (BY-SA) license

flickr photo by shared under a Creative Commons (BY-SA) license

Your Quiz#11 is to create a blog post with your answers to the quiz questions.

I highly recommend that you place the code on GitHub but will accept links to PUBLIC Dropbox (or Google Drive) files.

Write code to solve the following questions:


The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828,[1] and is the limit of (1 + 1/n)n as n approaches infinity, an expression that arises in the study of compound interest. It can also be calculated as the sum of the infinite series[2]


Write a function called calculateE that receives a single float parameter accuracy and calculates the value of e using using sufficient terms (ie: there are 4 terms shown above for n equal to 0, 1, 2, 3) until the difference between two successive calculations differ by LESS than the parameter accuracy.


Write a function called checkBanana that receives a single parameter of type string that is the name of a file in the same directory as the program. The function opens that file of text and counts the number of times that the string “banana” appears. For full marks it should ignore case (so count Banana, BANANA, bAnAnA regardless of mix of upper and lower case characters).

To test your program, create your own file to test with in the same directory as your program.


Again, post your solutions on YOUR blog with hashtag #Quiz11, deadline is before midnight Saturday November 21.


CC BY 4.0 Quiz 11 by Ken Bauer is licensed under a Creative Commons Attribution 4.0 International License.