May 2017
Intermediate to advanced
280 pages
6h 2m
English
Let's do an exercise.
See the given file, batman.txt, containing the quotes from famous Hollywood movies.
Our aim is to write a program to find a given word from the file:

Let's write a program to find the particular word from the file. We are making the assumption that the program should be case insensitive, which means it does not matter whether the characters are in uppercase or lowercase.
See the code in findword.py:
word = raw_input("Enter the word ")word = word.lower()file_txt = open("batman.txt", "r")count = 0for each in file_txt: if word in each.lower(): count = count+1print "The ", word ," occured ...Read now
Unlock full access