Skip to content

Instantly share code, notes, and snippets.

View Mehfooz201's full-sized avatar
🏠
Working from home

Mehfooz Ali Mehfooz201

🏠
Working from home
View GitHub Profile
@solen003
solen003 / letter_digit_counter.py
Created July 15, 2018 21:57
Write a program that accepts a sentence and calculate the number of letters and digits. Suppose the following input is supplied to the program: hello world! 123 Then, the output should be: LETTERS 10 DIGITS 3
phrase = input("Type in: ")
phrase = list(phrase)
l, d = 0, 0
for i in phrase:
if i.isalpha():
l = l + 1
if i.isdigit():
d = d + 1
else: