Quiz Week 14

Survey Time

Please fill out the survey to evaluate your professors. These are very important tools to give feedback to your professors and we do take it very seriously. For myself I really appreciate the comments that you provide to help improve my teaching going forward. Even after 22 years of teaching I still have much to learn and especially from you the students.

You can enter the survey by going to https://mitecbeta.itesm.mx and then search for ECOA.

Thanks for doing this, I appreciate it and look forward to 100% of my students doing this.

Self Evaluation Time

Please check which of the Mastery topics you have covered in your blog posts. I created a Google spreadsheet which you can copy in order to keep track of this. Feel free to use “File->Make a copy.” to do that for yourself.

You can find that spreadsheet here: http://url.kenbauer.me/tc1014mastery

Feature Photo Credit

<a title="Powerpoint Slide:   "Teachers should be activators"" href="https://flickr.com/photos/kenwhytock/8471566783">Powerpoint Slide:   "Teachers should be activators"</a> flickr photo by <a href="https://flickr.com/people/kenwhytock">Ken Whytock</a> shared under a <a href="https://creativecommons.org/licenses/by-nc/2.0/">Creative Commons (BY-NC) license</a> </small>
Powerpoint Slide: “Teachers should be activators” flickr photo by Ken Whytock shared under a Creative Commons (BY-NC) license

WSQ13 – Cars

What To Do

File input/output is our access to permanent stores of data that last beyond the run time of our application.

Write a program that opens and reads the file 93cars.dat.txt and produces the following data:

  • average gas mileage in city (City MPG)
  • average gas mileage on highway (Highway MPG)
  • average midrange price of the vehicles in the set.

You can find the data set at the following link from the Journal of Statistics Education.

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ13 on your post so our blog hub picks that up.

You should include your code as a link to GitHub.

And of course, leave any questions here as well as asking those questions in our Slack channel so we all see your question posted there.

Feature Image Credit

<a title="car" href="https://flickr.com/photos/inucara/8441125237">car</a> flickr photo by <a href="https://flickr.com/people/inucara">Kentaro Ohno</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
car flickr photo by Kentaro Ohno shared under a Creative Commons (BY) license

WSQ12 – Estimating e

What To Do

In this assignment you will estimate the mathematical constant e. You should create a function called calculuate_e which receives one parameter called precision that should specify the number of decimal points of accuracy.

You will want to use the infinite series to calculate the value, stopping when the accuracy is reached (previous and current calculation are the same at the specified accuracy).

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ12 on your post so our blog hub picks that up.

You should include your code as a link to GitHub.

And of course, leave any questions here as well as asking those questions in our Slack channel so we all see your question posted there.

Feature Image Credit

<a title="e" href="https://flickr.com/photos/gailtang/2786292212">e</a> flickr photo by <a href="https://flickr.com/people/gailtang">gail m tang</a> shared under a <a href="https://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons (BY-NC-SA) license</a> </small>
e flickr photo by gail m tang shared under a Creative Commons (BY-NC-SA) license

 

WSQ11 – Go Bananas

What To Do

Write a function called find_bananas which receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word (string) “banana”  (or “BANANA” ) is found in the file. The banana can be any case (‘BaNana’ or ‘BANANA’ or ‘banana’, etc) and they can be “stuck together” like “banAnaBANANA” (that counts as two). Create your own test file (plain text) to check your work.

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ11 on your post so our blog hub picks that up.

You should include your code as a link to GitHub.

And of course, leave any questions here as well as asking those questions in our Slack channel so we all see your question posted there.

Feature Image Credit

<a title="Colored Bananas" href="https://flickr.com/photos/cleberquadros/3834587963">Colored Bananas</a> flickr photo by <a href="https://flickr.com/people/cleberquadros">Cleber Quadros</a> shared under a <a href="https://creativecommons.org/licenses/by-nc/2.0/">Creative Commons (BY-NC) license</a> </small>
Colored Bananas flickr photo by Cleber Quadros shared under a Creative Commons (BY-NC) license

 

WSQ10 – Babylonian Method

Background

In this assignment you will write a function to calculate the square root of a number using the Babylonian method. You can search for that method, it will be easy to find.

What to Do

The function should receive a number and return floating point number. Obviously you should test your function, so create a main program that asks the user a value, calculates the square root and displays that.

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ10 on your post so our blog hub picks that up.

You should include your code as a link to GitHub.

And of course, leave any questions here as well as asking those questions in our Slack channel so we all see your question posted there.

Feature Image Credit

<a title="Babylonian Fresco" href="https://flickr.com/photos/brimley/4156702926">Babylonian Fresco</a> flickr photo by <a href="https://flickr.com/people/brimley">Brimley</a> shared under a <a href="https://creativecommons.org/licenses/by-nc/2.0/">Creative Commons (BY-NC) license</a> </small>
Babylonian Fresco flickr photo by Brimley shared under a Creative Commons (BY-NC) license

QuizWeek#11

Practice Exam

Download and attempt to solve the problems in the attached exam file.

The real exam next week will be shorter but drawn from these questions.

I would expect everyone to be able to do all except #8 and #9 now but I know there are some of you that could do those now.

Featured Image Credit

<a title="2016/366/26 Pair Programming" href="https://flickr.com/photos/ken_bauer/24271690249">2016/366/26 Pair Programming</a> flickr photo by <a href="https://flickr.com/people/ken_bauer">kenbauer</a> shared under a <a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative Commons (BY-SA) license</a> </small>
2016/366/26 Pair Programming flickr photo by kenbauer shared under a Creative Commons (BY-SA) license

 

Quiz Week 09

Distance

Write a function that receives four parameters: x1, y1, x2, y2 which are all floating point values.

The function is called distance and returns (float) the distance between x1,y1 and x2,y2 on the cartesian coordinate plane.

What to Submit

Post on your blog your solution and include your code somehow (image, in the post or via GitHub) and remember to include the hashtag #quiz09

Featured Image Credit

<a title="distance..." href="https://flickr.com/photos/iloveakira/5090708070">distance...</a> flickr photo by <a href="https://flickr.com/people/iloveakira">Pia Kristine</a> shared under a <a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative Commons (BY-SA) license</a> </small>
distance… flickr photo by Pia Kristine shared under a Creative Commons (BY-SA) license

WSQ09 – Multipart Data and Files

Your Assignment

So for this assignment I would like to see you create a function that receives as parameter the name of a file (this would be a string value like data.txt) and your function counts the number of lines and the number of characters in the file which it returns as a single value (but with two values). You will want to look at how to use and return a tuple from a function and how to open and read text files line by line.

What To Submit

As always a blog post, tag with #WSQ09 and perhaps put your code up on GitHub. Ask for help or input via Slack in our #tc1014gda channel.

Feature Image Credit

<a title="Files" href="https://flickr.com/photos/takashi/18862634">Files</a> flickr photo by <a href="https://flickr.com/people/takashi">T a k</a> shared under a <a href="https://creativecommons.org/licenses/by-nc/2.0/">Creative Commons (BY-NC) license</a> </small>
Files flickr photo by T a k shared under a Creative Commons (BY-NC) license

Quiz Week 8

Two Activities

  • Please fill out our mid-semester survey. This will not take long at all and in the spirit of non grading based on points, there is simply two open questions. How can you improve and how can Ken help you improve your learning.
    Fill out that survey here: http://url.kenbauer.me/midtermsurvey
  • Write a function that calculates returns the “nth” Fibonacci number where we define a function over the Fibonacci numbers mapping the naturals (starting with zero) to the Fibonacci series. So fibonacci(0) returns 0, fibonacci(1) returns 1, fibonacci(2) returns 1 and so on. Note that we are using the modern definition where the sequence starts with zero. You should try to implement this with two solutions: one with a loop and one with recursion. Which do you think is “better”, which looks more “elegant”, which is more “efficient”?

Featured Image Credit

<a title="Fibonachess" href="https://flickr.com/photos/fdecomite/3200758169">Fibonachess</a> flickr photo by <a href="https://flickr.com/people/fdecomite">fdecomite</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
Fibonachess flickr photo by fdecomite shared under a Creative Commons (BY) license

 

WSQ08 – Yo Soy 196

Background

Lychrel numbers are natural numbers that do not form a palindrome after successive additions to their inverse. See details on Wikipedia: http://en.wikipedia.org/wiki/Lychrel_number

What to Do

Your job is to create a program that asks the user for two pieces of data:

  • The lower bound of the sequence
  • The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”

Details

The report must show:
  • The range of numbers analysed (lower to upper bound)
  • The number of natural palindromes (no addition to inverse needed)
  • The number of non-Lycherels encountered (become palindromes)
  • The number of Lycherel number candidates (that did not converge to palindrome)

Since you will not be able to prove that a number is Lycherel (since you cannot computer forever to check), our definition for a Lycherel candidate will be if a number does not converge after 30 iterations of applying the addition to the inverse.

This is easier in Python but if you are curious and want to try this in C++ (Java would be similar), to get this working well, you will need support for Big Integers. You can base your solution off my codebase on GitHub. Unzip all of the files in a directory and use the command “make” to compile. Run the executable.

How to use BigInteger and make

Video Demo

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ08  on your post so our blog hub picks that up.

You should include your code as a link to GitHub. You really should start using your GitHub repository now. If you need help on that, just ask Ken or your classmates.

And of course, leave any questions here as well as asking those questions on our Slack in the #TC1014gda channel so we all see your question posted there.

Feature Image Credit

Background Lychrel numbers are natural numbers that do not form a palindrome after successive additions to their inverse. See details on Wikipedia: http://en.wikipedia.org/wiki/Lychrel_number What to Do Your job is to create a program that asks the user for two pieces of data: The lower bound of the sequence The upper bound of the sequence Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like "Found a Lychrel number: 196" Details The report must show: The range of numbers analysed (lower to upper bound) The number of natural palindromes (no addition to inverse needed) The number of non-Lycherels encountered (become palindromes) The number of Lycherel number candidates (that did not converge to palindrome) Since you will not be able to prove that a number is Lycherel (since you cannot computer forever to check), our definition for a Lycherel candidate will be if a number does not converge after 30 iterations of applying the addition to the inverse. To get this working well, you will need support for Big Integers. You can base your solution off my codebase on GitHub. Unzip all of the files in a directory and use the command "make" to compile. Run the executable. How to use BigInteger and make Video Demo What to Submit As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ08 on your post so our blog hub picks that up. You should include your code as a link to GitHub. You really should start using your GitHub repository now. If you need help on that, just ask Ken or your classmates. And of course, leave any questions here as well as asking those questions on Twitter with the hashtag #TC1017 so we all see your question posted there. Feature Image Credit <a title="The Magic Numbers" href="https://flickr.com/photos/kenandpauline/5490820">The Magic Numbers</a> flickr photo by <a href="https://flickr.com/people/kenandpauline">K & P</a> shared under a <a href="https://creativecommons.org/licenses/by-nc-nd/2.0/">Creative Commons (BY-NC-ND) license</a> </small> The Magic Numbers flickr photo by K & P shared under a Creative Commons (BY-NC-ND) license
Background
Lychrel numbers are natural numbers that do not form a palindrome after successive additions to their inverse. See details on Wikipedia: http://en.wikipedia.org/wiki/Lychrel_number
What to Do
Your job is to create a program that asks the user for two pieces of data:
The lower bound of the sequence
The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”
Details
The report must show:
The range of numbers analysed (lower to upper bound)
The number of natural palindromes (no addition to inverse needed)
The number of non-Lycherels encountered (become palindromes)
The number of Lycherel number candidates (that did not converge to palindrome)
Since you will not be able to prove that a number is Lycherel (since you cannot computer forever to check), our definition for a Lycherel candidate will be if a number does not converge after 30 iterations of applying the addition to the inverse.
To get this working well, you will need support for Big Integers. You can base your solution off my codebase on GitHub. Unzip all of the files in a directory and use the command “make” to compile. Run the executable.
How to use BigInteger and make
Video Demo
What to Submit
As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ08 on your post so our blog hub picks that up.
You should include your code as a link to GitHub. You really should start using your GitHub repository now. If you need help on that, just ask Ken or your classmates.
And of course, leave any questions here as well as asking those questions on Twitter with the hashtag #TC1017 so we all see your question posted there.
Feature Image Credit
The Magic Numbers flickr photo by K & P shared under a Creative Commons (BY-NC-ND) license
The Magic Numbers flickr photo by K & P shared under a Creative Commons (BY-NC-ND) license