Jake Blank wrote:
> I finally got it.
> This was the code:
> for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):
> print (k, word_count[k])
>
> The only question i have now is how to limit the amount of returns the
> program runs to the first 15 results.
Hint:
On 05/05/14 04:13, Jake Blank wrote:
I did have one more question though.
import os
from wordtools import extract_words
source_filepath=input("Enter the path to the source file:")
dest_filepath =input("Enter the path to the destination file:")
I'm wondering how I can make it so the program ca
To figure that last part out I just did a simple if statement.
for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):
if word_count[k] >=300:
print (k, word_count[k])
And the output was correct.
I did have one more question though.
import os
from wordtools
Hi,
I finally got it.
This was the code:
for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):
print (k, word_count[k])
The only question i have now is how to limit the amount of returns the
program runs to the first 15 results.
On Sun, May 4, 2014 at 10:19 PM
On May 4, 2014 11:13 PM, "Jake Blank" wrote:
>
> To figure that last part out I just did a simple if statement.
> for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):
> if word_count[k] >=300:
> print (k, word_count[k])
> And the output was correct.
Jake,
Hi Jake,
Please do be sure to use Reply All rather than just Reply. I'm sending
my reply and and quotes from yours to the list; that way, others can
follow along, learn and help.
Also, in general, reply under the messages to which you respond,
ideally trimming what isn't needed away. (You will se
>ordered_keys = word_count.keys()
>sorted(ordered_keys)
sorted() does not modify the list, but returns a sorted version of the
list for me on Python 2.7
my_sorted_list = sorted(ordered_keys)
This will alphabetize all of the words, regardless of frequency.
>print ("All the words and their frequenc
On May 4, 2014 8:31 PM, "Jake Blank" wrote:
>
> Hi,
> So I'm doing a problem on the Alice_in_wonderland.txt where I have to write a
> program that reads a piece of text from a file specified by the user, counts
> the number of occurrences of each word, and writes a sorted list of words and
> th
Hi,
So I'm doing a problem on the Alice_in_wonderland.txt where I have to write
a program that reads a piece of text from a file specified by the user,
counts the number of occurrences of each word, and writes a sorted list of
words and their counts to an output file. The list of words should be
so