Yo Soy 196 and Word Counter

I think these was the most difficult codes of the course and these are the instructions:

Yo soy 196:

Your jobs 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”
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.

Word Counter:

Create a program that asks the user for a word which will be your search word and the name of a file to open and search for that word. Then create a function that will receive two parameters (both string) representing those two data points. This function returns the number of occurrences of that word in that file.

You will need to open a file and read the text line by line. This is straight forward in Python since you can treat the file as a list of lines (strings) and iterate over that using a for loop. Check the section “Looping over a file object” in this link for an idea but your book also has this information

2016-05-04 (2)
2016-05-04 (3)

on Lynda.com) http://www.pythonforbeginners.com/files/reading-and-writing-files-in-python

For C++ this is similar in solution as for the Python group, this link may help you but feel free to find others: http://www.cplusplus.com/doc/tutorial/files/ Also remember to check the videos you have access to on Lynda.com

This is the Word Count code:

2016-05-04 (2)

This is Yo Soy 196 code:

2016-05-04 (3)

In a few days I’m going to explain the codes! SEE YOU GUYS!

Yo soy 196 code 

Word Counter code

SEE YOU IN MY NEXT POST!!!

 

 

 

 

 

 

CC BY-SA 4.0 Yo Soy 196 and Word Counter by sercho93 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.