# This program reads in a file and prints out the words that make up the first # n characters (not counting spaces) # If the nth character falls in the middle of a word, we print out the whole word. # i.e. it is ok to go slightly over n characters # If the file is shorter than n characters, we will print out the whole file. filename = "tiger.txt" # we'll use the Tiger poem. Move it into this directory # open the file and read in all the words here # Remember to close the file when you're done! # Now we will generate a long string that contains at least n characters (not counting spaces) numCharsNeeded = 50 # This is the number of characters that we need. # We will use the programming pattern that we learned in class. longString = "" numCharsSoFar = 0 # This is the initial value # Now we will loop through the list of words in the file. # When will we need to add words to longString? # Print out the words and the length of the final string (not including spaces) when done.