subject

Write a function named count_letters that takes as a parameter a string and returns a dictionary that tabulates how many of each letter is in that string. the string can contain characters other than letters, but only the letters should be counted. the string could even be the empty string. lower-case and upper-case versions of a letter should be part of the same count. the keys of the dictionary should be the upper-case letters. if a letter does not appear in the string, then it would not get added to the dictionary. the dict and count function may not be used. for example, if the string is```"aabb"```then the dictionary that is returned should contain these key-value pairs: ```{'a': 2, 'b': 2}so far i am stuck at(which is not working correctly when given to capitalized values, ex "aa" returns 1): def count_letters(string): letter_dic = { } for letter in string: if letter in letter_dic: letter_dic[letter] = +1 else: letter_dic[letter] = 1 return letter_dic

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
If your accelerator suddenly gets stuck what should you do
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
Which of the following calculates the total from the adjacent cell through the first nonnumeric cell by default, using the sum function in its formula? -average -autosum -counta -max
Answers: 1
You know the right answer?
Write a function named count_letters that takes as a parameter a string and returns a dictionary tha...
Questions
Questions on the website: 13722360