Hey there, I am finally uploading all the Quiz, here I leave you the explanation for each one of the 2 problems of the Quiz 5 and how I solve it.
Part 1:
The part one of the Quiz was a little bit like the #YoSoy196 but it was a little bit different because for flipping the word I look on the internet for a different method because the one I use on the program that look for Lychrel numbers it uses a function to flip number using mod, but this time it was completely different, but in the process of checking it was the same as the #YoSoy196.
Here is what our teacher asked for:
- 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).
You can check the hall assignment on this link: http://kenscourses.com/tc101winter2016/2016/03/quiz-05/
Here is the link for the program: https://gist.github.com/batmantec/24c127e27fef36fed4d21c167b529ec5
Here is the pictures of the program running:
Part 2:
For the part 2 it was somehow easier for me to get it done, because I didn’t need to look on the internet for doing it. I just recall some knowledge that I had before it from other programs.
Here is what our teacher asked for:
- 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,
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)
You can check the hall assignment on this link: http://kenscourses.com/tc101winter2016/2016/03/quiz-05/
Here is the link for the program: https://gist.github.com/batmantec/3085ef3cb8ead203c68cf8f33abbcd85
Here is the pictures of the program running:
Quiz 5 by batmantec is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.