i keep getting an error and the problem is the print counts what is the right way to print the key and the count for this program also if you see any other errors please point them out
import string #To get punctuation characters
def readfile(fname):
”’Return contents of a text file as a lower-case string”’
f = open(fname, ‘r’) #Open the file for reading
contents = f.read() #Read the contents of the file as one long string
f.close() #Close the file
for char in string.punctuation: #Use string.punctuation to remove punctuation
contents = contents.replace(char, ‘ ‘)
return contents.lower() #Return the string (converting it to lower case
def count_pronouns(word_list, pronoun_list):
”’Returns a dictionary with words and their counts
word_list is a list of words from the text file
pronoun_list is a list of English pronouns”’
my_dict = {} #Start with an empty dictionary
for word in word_list: #For each word in word_list
if word in pronoun_list: #If the word is a pronoun then
if word not in my_dict: #If the word is not in the dictionary
my_dict[word] = 1
else:
my_dict[word] += 1
return my_dict #Return the dictionary
def show_counts(pronoun_dict):
”’Print prounouns and their counts; print only those with counts > 0
pronoun_dict is the dictionary of pronouns with their counts”’
key_list = list(pronoun_dict.keys())
key_list = key_list.sort() #Sort the list of keys
for key in key_list: #For each key in the key list
if pronoun_dict[key] > 0: #If the count is greater than 0
print(pronoun_dict[key]): #Print the key and the count
def main():
text_filename = ‘Data//gb.txt’ #Count pronouns in this file
pronoun_filename = ‘Data//pronouns.txt’ #List of pronouns
gb = readfile(text_filename) #gb is the contents of the text file (a string)
gb_words = gb.split() #Split file contents into a list of words
pronouns = readfile(pronoun_filename)
pronoun_list = pronouns.split()
pronoun_dict = count_pronouns(gb_words, pronoun_list)
show_counts(pronoun_dict)
main()
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Keep Getting An Error And The Problem Is The Print Counts What Is The Right Wa
/in Uncategorized /by developeri keep getting an error and the problem is the print counts what is the right way to print the key and the count for this program also if you see any other errors please point them out
import string #To get punctuation characters
def readfile(fname):
”’Return contents of a text file as a lower-case string”’
f = open(fname, ‘r’) #Open the file for reading
contents = f.read() #Read the contents of the file as one long string
f.close() #Close the file
for char in string.punctuation: #Use string.punctuation to remove punctuation
contents = contents.replace(char, ‘ ‘)
return contents.lower() #Return the string (converting it to lower case
def count_pronouns(word_list, pronoun_list):
”’Returns a dictionary with words and their counts
word_list is a list of words from the text file
pronoun_list is a list of English pronouns”’
my_dict = {} #Start with an empty dictionary
for word in word_list: #For each word in word_list
if word in pronoun_list: #If the word is a pronoun then
if word not in my_dict: #If the word is not in the dictionary
my_dict[word] = 1
else:
my_dict[word] += 1
return my_dict #Return the dictionary
def show_counts(pronoun_dict):
”’Print prounouns and their counts; print only those with counts > 0
pronoun_dict is the dictionary of pronouns with their counts”’
key_list = list(pronoun_dict.keys())
key_list = key_list.sort() #Sort the list of keys
for key in key_list: #For each key in the key list
if pronoun_dict[key] > 0: #If the count is greater than 0
print(pronoun_dict[key]): #Print the key and the count
def main():
text_filename = ‘Data//gb.txt’ #Count pronouns in this file
pronoun_filename = ‘Data//pronouns.txt’ #List of pronouns
gb = readfile(text_filename) #gb is the contents of the text file (a string)
gb_words = gb.split() #Split file contents into a list of words
pronouns = readfile(pronoun_filename)
pronoun_list = pronouns.split()
pronoun_dict = count_pronouns(gb_words, pronoun_list)
show_counts(pronoun_dict)
main()
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Keep Getting Conflicting Answers Ive Been Working On These For Day And I Cant
/in Uncategorized /by developerI keep getting conflicting answers Ive been working on these for day and I cant understand what they atre wanting especially since my answers never match i dont know where i am going wrong
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know How To Set Up The First Part Of Finding Xi On Our Table We Set Up But I A
/in Uncategorized /by developerI know how to set up the first part of finding Xi on our table we set up, but i am struggling to understand how to solve for the Pi parts of the equation. i am drawing a blank on how to solve for the probability of $599? once i can figure out how t o solve the first one i can be sure to repeat fort he next number.
the formula for p(x)= P(X=x) so in my mind p(1 prize for 599)= 1/5000 or 1/29 not sure if that is right… but thats what i think.
Five thousand tickets are sold at? $1 each for a charity raffle. Tickets are to be drawn at random and monetary prizes awarded as? follows: 1 prize of
?$600, 3 prizes of $300?, 5 prizes of ?$20?, and 20 prizes of? $5. What is the expected value of this raffle if you buy 1? ticket?
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know It Is Short Time Notice This Is My First Time At This Process But I Can P
/in Uncategorized /by developerI know it is short time notice. This is my first time at this process. But I can probably wait til 10:00 PM because I have to turn in assignment at 11:00 PM. That is the most I can wait. Let me know if that is enough time if not so that I can try to get help some where else. Thank you.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know Its Short Notice But Looking For Help With This Assignment Late Friday Ev
/in Uncategorized /by developerI know its short notice, but looking for help with this assignment late Friday evening. I have attached the template required for this assignments with the detailed instructions. I have also attached the name of the book were using for this course.
Digitial Course Material:
The Life Span
Human Development for Helping Professionals
Patricia C. Broderick Bennett Pierce Prevention Research Center at Penn State University
Pamela Blewitt Villanova University
https://reader.yuzu.com/#/books/9780135206171/cfi/3!/4/[email protected]:19.2
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know That Ms Excel Has Been Around For Quite Some Time But Unfortunately I Hav
/in Uncategorized /by developer2. I am playing the role of an administrator and I have recorded requests from different locations, the states are listed in the sheet below. In the table below I have the request I have made against the locations of those request, could anyone help explain to me how the data is collected?
Software Installation Request Software Update Request Hardware Installation Request
WV 23 12
MD 13 8 5
VA 17 4 6
DC 14 6 2
NY 7 4 1
FL 29 21 11
1. What would be the best data gathering I could use?
2. I would like to see
3.
4.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know The Actual Formulas But I Also Know You Need To Use The First Total Cost
/in Uncategorized /by developerI need help in the formulas to get the AVC AFC and ATC. I know the actual formulas but I also know you need to use the first total cost output for some of the functions.
The cost structure of a manufacture for microchips is described in the table shown below.
The firm’s fixed cost equal $15,000 per day. Calculate the average variable cost, average fixed cost, and average total cost at each output level. (answers need to be rounded to the nearest cent.)
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know The Answer Is 7 8 What Is The Formula
/in Uncategorized /by developerI know the answer is 7.8% – what is the formula?millions) = $400. What percentage of the CEO’s total earnings are tied to profits of the firm.
Suppose compensation is given by W = 512,000 + 217X(Profits)+ 10.08S, where W = totalcompensation of the CEO, X = company profits (in millions) = $200, and S = Sales (in millions) = $400.What…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know The Formula To Be Used But Having Trouble Identifying Factors To Plug In
/in Uncategorized /by developerneed help with these two problems. i know the formula to be used but having trouble identifying factors to plug in. Please set up equation so I can see where things go.1. Calculate the force of gravity betwen the earth(mass – 6.0 x 10 to the 24th kg) and the moon (mass = 7.4 x 10 to the 22 powerkg) The average earth distance is 3.8 x 10 to the 8th powerm.2. Calculate the force of gravity between a new born baby of mass 4 kg and the obstetrician of mass 75kg, who is 0.3 m from the baby.3. Calculate the force of gravity on a l kg mass at the earths surface. Tha mass of earth is 6 x 10 to the 24 power and its radius is 6.4 x 10 to the 9th power.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Know The General Concept Of An Income Effect But I Am Not Sure About The Effec
/in Uncategorized /by developerI know the general concept of an income effect.But, i am not sure about the effect with ONE-TIME income increase.Does recieving ONE-TIME tax refund of $2000 makes an income effect?
A onetime tax refund of $ 2000 does not make an income effect because this cannot be classifiedas income. It is refund and does not arise from a business deal. It is money that you are getting…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"