Computer Science, asked by mayankkhurana51, 6 months ago

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 Japji21
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