In python, if you have a dictionary, called count, which has each word in a book as its key, and the number of occurances of that word as its value, how do you create a second dictionary, count2, which is just the dictionary of words that appear between 15 and 20 times in the book (use dictionary comprehension)?
Answer
count2 = { key:value for key, value in count.items() if value <= 20 and value >= 15 }
Question
In python, if you have a dictionary, called count, which has each word in a book as its key, and the number of occurances of that word as its value, how do you create a second dictionary, count2, which is just the dictionary of words that appear between 15 and 20 times in the book (use dictionary comprehension)?
Answer
?
Question
In python, if you have a dictionary, called count, which has each word in a book as its key, and the number of occurances of that word as its value, how do you create a second dictionary, count2, which is just the dictionary of words that appear between 15 and 20 times in the book (use dictionary comprehension)?
Answer
count2 = { key:value for key, value in count.items() if value <= 20 and value >= 15 }
If you want to change selection, open document below and click on "Move attachment"
pdf
owner: kkhosravi - (no access) - PYTHON_DATA_STRUCTURES_AND_ALGORITHMS.pdf, p58
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.