#QUESTION 1 Go to https://www.gutenberg.org/ (Links to an external site.) select a free ebook and download the plain text file.
Write a program that does the following:
- Read in your ebook (any book, any language)
- Break the book into word
- Make a dictionary of all words and how often they occur: for instance if the word ‘the’ happened 2000 time and the word ‘a’ happened 1940 times word_dict= {‘the’ : 2000, ‘a’ :1940}
- Print the dictionary of word frequencies to a file (freqs.txt) with the most frequent at the top and least frequent at the bottom
Turn in your python code firstname.lastname.py, your freqs.txt file, and a copy of your ebook(the input file)
………….
to sort by value
<code><span class="kwd">import</span> operator sorted_dict <span class="pun">=</span> sorted<span class="pun">(my_dict</span><span class="pun">.</span><span class="pln">items</span><span class="pun">(),</span> key<span class="pun">=</span><span class="pln">operator</span><span class="pun">.</span><span class="pln">itemgetter</span><span class="pun">(</span><span class="lit">1</span><span class="pun">))</span></code>
#QUESTION 2
#make the following function print the right answer
def year_of_birth(age,current_year):
print(year_of_birth(21,2017))
#QUESTION 3
# define a list that contains your favorite food
# Ask the User for their favorite food
# Add it to the list
# print out the list using a loop such as
#THE NEW COLORS OF THE RAINBOW ARE
#1:food 1
#2:food 2
#3:food 3
#4:food 4
#5:whatever the user entered
#Bonus 2 points print in reverse order as well
#QUESTION 4
#ask the User to add one topping to the pizza
#modify to dictionary to have that item
#print out every topping the pizza contains
#”this pizza contains Topping 1,Topping 2…Topping 3 (including the topping the
user added”
toppings={‘peperoni’:True,’olives’:False,”pineapple”:True,”sausage”:False,”jalapeno
s”:False}
Looking for a solution written from scratch with No plagiarism and No AI?
WHY CHOOSE US?
We deliver quality original papers |
Our experts write quality original papers using academic databases.We dont use AI in our work. We refund your money if AI is detected |
Free revisions |
We offer our clients multiple free revisions just to ensure you get what you want. |
Discounted prices |
All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount |
100% originality |
We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity.We have ZERO TOLERANCE TO USE OF AI |
On-time delivery |
We will deliver your paper on time even on short notice or short deadline, overnight essay or even an urgent essay |