Quiz 05

flickr photo by GmanViz https://flickr.com/photos/gmanviz/14946678167 shared under a Creative Commons (BY-NC-ND) license

Weekly Quiz

Write your code for the quiz, then:

  • email your answers (as file attachments) to Ken.
  • Most important: blog about your answers. You should explain the code, your process and link to code on GitHub.

The Quiz (same for both C++/Python)

  1. Create a function called is_palindrome which receives a string as a parameter and returns true if that string is a palindrome, false otherwise. Remember that a palindrome is a word that is the same forward or backward. For full points your function must ignore case and must work with any character (not just letters). So (“Dad$dad” is a palindrome even though the D is capital and d is lower case).
  2. Create a function called find_threes that receives as a parameter a list (or Vector or array for C++ students) of numbers and returns the sum of all numbers in that list that are evenly divisible by 3. Note if using vectors, you will need an additional parameter to represent the number of numbers in the array. So if the list was [0,4,2,6,9,8,3,12], the function would return 30 (0+6+9+3+12)
flickr photo by GmanViz https://flickr.com/photos/gmanviz/14946678167 shared under a Creative Commons (BY-NC-ND) license
flickr photo by GmanViz https://flickr.com/photos/gmanviz/14946678167 shared under a Creative Commons (BY-NC-ND) license

Get Creative, put style in your Blog Posts

Make the posts your expression, be good internet citizens but also have fun!

CC BY-SA 4.0 Quiz 05 by Ken Bauer is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

One thought on “Quiz 05

Leave a Reply

Your email address will not be published. Required fields are marked *