Skip to content

Commit 52e73a3

Browse files
Merge pull request #805 from emmanuelotabil/master
Letter_Counter
2 parents 26233e3 + 8390923 commit 52e73a3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Letter_Counter.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Letter Counter App
2+
3+
print("Hey there! Welcome to the Letter Counter App")
4+
5+
# Get user input.
6+
name = input("\nWhat is your name: ").title().strip()
7+
print("Hello, " + name + "!")
8+
9+
print("In this app, I will count the number of times that a specific letter occurs in a message.")
10+
message = input("\nPlease enter a message: ")
11+
letter = input("Which letter would you like to count the occurrences of?: ")
12+
13+
# Standardize to lower case.
14+
message = message.lower()
15+
letter = letter.lower()
16+
17+
# Get the count and display results.
18+
letter_count = message.count(letter)
19+
print("\n" + name + ", your message has " + str(letter_count) + " " + letter + "'s in it.")

0 commit comments

Comments
 (0)