string=input('enter string:') alpha=0 digits=0 special=0 for i in string: if i.isdigit(): digits+=1 elif i.isalpha(): alpha+=1 else: special+=1 print('digits:',digits,'alphabets:',alpha,'special character:',special)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter