Question: Write a Python program to find occurrence of each character in the given string by using dictionary concept. Note:- The input should be string only,
Write a Python program to find occurrence of each character in the given string by using dictionary concept.
Note:-
The input should be string only, in order to represent the same use pair of single quotes only (eg:- good). Otherwise if your input is other than string then simply print Invalid input.
The result should be in the prescribed format only (Case sensitive).
Print the result in ascending order (according to the ASCII code).
Grade deduction is 15% for each test cases. Totally four test cases are given.



Write a Python program to find occurrence of each character in the given string by using dictionary concept. Note:- The input should be string only, in order to represent the same use pair of single quotes only (eg:- 'good'). Otherwise if your input is other than string then simply print "Invalid input". The result should be in the prescribed format only (Case sensitive). Print the result in ascending order (according to the ASCII code). Grade deduction is 15% for each test cases. Totally four test cases are given. Sample input and output:- Input:- 'Good_is_good' Output:- The result is: G:1 :2 d:2 9:1 i:1 0:4 S: 1 Input:- 426 Output:- Invalid input Input:- 4.5 Output:- Invalid input Input:- 'Good' Output:- The result is: G:1 d: 1 0:2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
