numofwords=0 numofdigits=0 numofletters=0 text=input("enter a text:") for x in text: if x>='0' and x<='9': numofdigits+=1 elif x==' ' : numofwords+=1 elif x>='A' and x<='Z': numofletters+=1 elif x>='a' and x<='z': numofletters+=1 print(numofwords) print(numofdigits) print(numofletters)
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