Write a Python program that accepts a string and calculate the number of digits and letters.
Sample Data : Python 3.2
Expected Output :
Letters 6
Digits 2
Answers
Answered by
2
Answer:
s = input("Input a string")
d=l=0
for c in s:
if c.isdigit():
d=d+1
elif c.isalpha():
l=l+1
else:
pass
print("Letters", l)
print("Digits", d)
Similar questions
Math,
3 months ago
Business Studies,
3 months ago
Biology,
3 months ago
Social Sciences,
10 months ago
Biology,
10 months ago