Question: Question 4 (1 points) Write a function that compx a string and etwa dietary with each unique character in the string arkey and its corresponding

Question 4 (1 points) Write a function that compx a string and etwa dietary with each unique character in the string arkey and its corresponding member of cavalta. As a reme, Quant 5 from Guided med Create a functies and get_char_count_dict with positional matutat. Imide your sa functire, you will saved to check fix ther types of variable being pwed in your penital altat - the variable type is a string, you will proceed with the function. -If the variable type beat a string your function will be the return statement to provide a value -1 to the fiction caller and will not pond any furth. - HINT: Let's way that you have a Python variable named z. To chand if the variable is a string, you come intances, str) or type(s) - str. Clackout: https://pythonprinciples com/blog/checklatring . After curing that the variabile type of your positional argument m. txt is a string your w functies will find change any perco durante in tutto coming the string over thed, that the functie motive Alle catering everything in txt to low, creempty dictionary that will store your wal. The tea for loop to itsate all curate in txt w follow - character in mustalary in your dictionary, create a new key-val entry in your dictionary with ther character a key and it malam - a caracter is already a key in your dictionary, it is exciting value by 1. - HINT: Let's way you have a Pythe dictionary tumand D. Yos can check if this dictionary Dhawa lory russend kwyl by the following temat: kyl in D Do not want whitepec (whitespace chamtar i Python is simply"). - Whath for loop finishes, your diction should be each character (no lary) and its comprad ing number of citat ( wala) Use the functie return statement to provide the newly constructed dictionary of character cants of the input tst to the functies called your function will not proceed any further Correct Checks If you were to run the following functies call your ratpratereld be as follow: >> D-get_char_count_dict("little') >>>print() (1:2, 1:1, "t": 2, 1) >> D-get_char_count_dict("Little') >>print() (1:2, 1:1, "t": 2, 1) >> D-get_char_cont dict(127) >>> prit() >>al - 'The mly imposible says the one you ever begin! >> D-get_char_count_dict (21) (2, 'h": 2, 3, 5, 'a': 5. '1': 2, 'y's 3, 1:4. '': 1, "p": 1, ": 3. 'b's 2, '': 1, ": 2, "I": 2, "v": 1, "g': 1, 1:1) >> D-get_char_count_dict() >>> prit() 0 Question 4 (1 points) Write a function that compx a string and etwa dietary with each unique character in the string arkey and its corresponding member of cavalta. As a reme, Quant 5 from Guided med Create a functies and get_char_count_dict with positional matutat. Imide your sa functire, you will saved to check fix ther types of variable being pwed in your penital altat - the variable type is a string, you will proceed with the function. -If the variable type beat a string your function will be the return statement to provide a value -1 to the fiction caller and will not pond any furth. - HINT: Let's way that you have a Python variable named z. To chand if the variable is a string, you come intances, str) or type(s) - str. Clackout: https://pythonprinciples com/blog/checklatring . After curing that the variabile type of your positional argument m. txt is a string your w functies will find change any perco durante in tutto coming the string over thed, that the functie motive Alle catering everything in txt to low, creempty dictionary that will store your wal. The tea for loop to itsate all curate in txt w follow - character in mustalary in your dictionary, create a new key-val entry in your dictionary with ther character a key and it malam - a caracter is already a key in your dictionary, it is exciting value by 1. - HINT: Let's way you have a Pythe dictionary tumand D. Yos can check if this dictionary Dhawa lory russend kwyl by the following temat: kyl in D Do not want whitepec (whitespace chamtar i Python is simply"). - Whath for loop finishes, your diction should be each character (no lary) and its comprad ing number of citat ( wala) Use the functie return statement to provide the newly constructed dictionary of character cants of the input tst to the functies called your function will not proceed any further Correct Checks If you were to run the following functies call your ratpratereld be as follow: >> D-get_char_count_dict("little') >>>print() (1:2, 1:1, "t": 2, 1) >> D-get_char_count_dict("Little') >>print() (1:2, 1:1, "t": 2, 1) >> D-get_char_cont dict(127) >>> prit() >>al - 'The mly imposible says the one you ever begin! >> D-get_char_count_dict (21) (2, 'h": 2, 3, 5, 'a': 5. '1': 2, 'y's 3, 1:4. '': 1, "p": 1, ": 3. 'b's 2, '': 1, ": 2, "I": 2, "v": 1, "g': 1, 1:1) >> D-get_char_count_dict() >>> prit() 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
