Dear blog, it’s been a while since my last post haha, but well it’s almost the en of the course!!! yay!! so I need to get this posts done, I’m in a good mood so I have to take advantage of that haha…<\/p>\n
Ok here’s Wsq12:<\/p>\n
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.<\/p>\n
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 \u201cLooping over a file object\u201d in this link for an idea but your book also has this information<\/p>\n
The link<\/a>\u00a0that Ken provide us was very useful, you should check it out<\/p>\n Also this link<\/a>\u00a0help me to understand a little bit more of this files thing in python.<\/p>\n Here are the screenshots of the program and terminal and the code in\u00a0GitHub<\/a>\u00a0as well.<\/p>\n <\/p>\n <\/p>\n So I hope you can use this, and see you well read you soon!!<\/p>\n <\/p>\n