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, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 07:00
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
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