Write a Python program that accepts a string and calculate thenumber of digits and letters
Sample Data : Python 3.9
Expected Output :
Letters 6
Digits 2
Hello!
It's ready!
import sys
arg = sys.argv[1]
print('Letters', sum(c.isalpha() for c in arg))
print('Digits', sum(c.isdigit() for c in arg))
Comments
Leave a comment