Skip to content

Instantly share code, notes, and snippets.

@KatiGithub
Created October 8, 2018 13:42
Show Gist options
  • Save KatiGithub/710b5df1650e76149b8e0b63c2a9ccfa to your computer and use it in GitHub Desktop.
Save KatiGithub/710b5df1650e76149b8e0b63c2a9ccfa to your computer and use it in GitHub Desktop.
This Python file calculates the number of letters and integers in an input or string
strchar = []
intchar = []
inpt = input("Input: ")
inpt = list(inpt)
for i in range(0, len(inpt)):
if inpt[i].isalpha():
strchar.append(inpt[i])
elif inpt[i].isdigit():
intchar.append(inpt[i])
print(str(len(strchar)) + " letter(s)")
print(str(len(intchar)) + " number(s)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment