haris018 commited on
Commit
7973b29
·
verified ·
1 Parent(s): 662fd62

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(page_title="Word & Letter Counter", layout="centered")
4
+
5
+ st.title("📝 Word & Letter Counter")
6
+
7
+ text = st.text_area(
8
+ "Enter your text below:",
9
+ height=200,
10
+ placeholder="Type or paste your text here..."
11
+ )
12
+
13
+ if text:
14
+ words = text.split()
15
+ word_count = len(words)
16
+ letter_count = len(text.replace(" ", ""))
17
+
18
+ st.subheader("📊 Results")
19
+ st.write(f"**Words:** {word_count}")
20
+ st.write(f"**Letters (excluding spaces):** {letter_count}")
21
+ else:
22
+ st.info("Please enter some text to count words and letters.")