Question #329940

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

Expert's answer

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))
LATEST TUTORIALS
APPROVED BY CLIENTS