'Create an action to calculate the number of letters and digits in sentence
I'm very new to GitHub and coding in general and I'm trying to learn more about the action tab. I'm trying to create a a formula that calculates the letters and numbers in a sentence. Could anyone help me to create the action steps or have any suggestion how could i start the action?
s = input() d={"DIGITS":0, "LETTERS":0} for c in s: if c.isdigit(): d["DIGITS"]+=1 elif c.isalpha(): d["LETTERS"]+=1 else:
pass print("LETTERS", d["LETTERS"]) print("DIGITS", d["DIGITS"])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
