0% found this document useful (0 votes)
18 views1 page

4 Py

The document describes a Python program that reads a multi-digit number from the console and calculates the frequency of each digit. It uses a dictionary to store the count of each character and prints the results with a suitable message. The output example demonstrates the frequency of digits from a given input string.

Uploaded by

Bhagyashree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

4 Py

The document describes a Python program that reads a multi-digit number from the console and calculates the frequency of each digit. It uses a dictionary to store the count of each character and prints the results with a suitable message. The output example demonstrates the frequency of digits from a given input string.

Uploaded by

Bhagyashree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

4. Read a multi-digit number(as chars) from the console.

Develop a program to print the


frequency of each digit with suitable message.

message=input('Enter your input:')

count=[ ]

for character in message:

[Link] (character, 0)

count[character]=count [character]+1

print('frequency of words appeared in the sentence or paragraph') print(count)

for k,v in [Link]():

print('character'+' '+str(k)+' '+' appeared'+str(v)+' '+'times')

Output
Enter your input: 123123123123123456784567845678

frequency of words appeared in the sentence or paragraph

{'1': 5, '2': 5, '3': 5, '4': 3, '5': 3, '6': 3, '7': 3, '8': 3}

character 1 appeared 5 times

character 2 appeared 5 times

character 3 appeared 5 times

character 4 appeared 3 times

character 5 appeared 3 times

character 6 appeared 3 times

character 7 appeared 3 times

character 8 appeared 3 times

You might also like