<p dir="ltr"><br>
On May 4, 2014 11:13 PM, "Jake Blank" <<a href="mailto:jakenblank@gmail.com">jakenblank@gmail.com</a>> wrote:<br>
><br>
> To figure that last part out I just did a simple if statement.<br>
> for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):<br>
>         if word_count[k] >=300:<br>
>                 print (k, word_count[k])<br>
> And the output was correct.<br></p>
<p dir="ltr">Jake,</p>
<p dir="ltr">That was in an effort to get only the 15most frequent words, if I understood your earliest post aright. If so, even if the output was correct for the case, that is by accident. What happens in only 3 distinct words show up 300 times? If 42 do?</p>

<p dir="ltr">You need to rethink, I think. Do you know how list indexing and list slicing work?</p>
<p dir="ltr">> I did have one more question though.  <br>
><br>
> import os   <br>
> from wordtools import extract_words<br>
><br>
> source_filepath=input("Enter the path to the source file:")<br>
> dest_filepath =input("Enter the path to the destination file:")<br>
><br>
> sourcef=open(source_filepath, 'r')<br>
> destf=open(dest_filepath, 'w')<br>
> for line in sourcef:<br>
>         destf.write(line)<br>
> file=input ("Would you like to process another file?(Y/N):")<br>
> if file== "Y":<br>
>     source_filepath=input("Enter the path to the source file:")<br>
>     dest_filepath =input("Enter the path to the destination file:")<br>
> else: <br>
>  <br>
> This code asks the user for a source/dest_filepath.  <br>
> I'm wondering how I can make it so the program can tell if the source/dest_filepath the user entered is actually a program on the computer.</p>
<p dir="ltr">" a program on the computer"? I assume that you mean file. </p>
<p dir="ltr">What happens if you run</p>
<p dir="ltr">open(" nowayyouhaveafilecalledthiscausethatdbesilly", 'r')</p>
<p dir="ltr">That's rather different than if the path is the path of an existing file, right. So, you could try to react differently to the two sorts of results.</p>
<p dir="ltr">Do you know how to use try an except?</p>
<p dir="ltr">> Also i have to ask the user if they would like to "process another file(Y/N)?" and I'm not sure where to put that.</p>
<p dir="ltr">I shall leave this for others; I'm not ready for my Monday, yet.</p>
<p dir="ltr">Best,</p>
<p dir="ltr">Brian vdB</p>