Skip to content

✔Streamlit is an open-source Python framework for data scientists and AI/ML engineers to deliver interactive data apps – in only a few lines of code.

License

Notifications You must be signed in to change notification settings

SumonPaul18/streamlit

Repository files navigation

🎯 Complete Beginner’s Guide to Python Streamlit

✅ Full Course in Simple English

📌 This guide is made for absolute beginners.
No prior knowledge of web development needed.
Just know basic Python, and you’re good to go!


🔰 What is Streamlit?

Streamlit is a free Python library that turns your Python scripts into interactive web apps in seconds.

You write simple Python code → Streamlit makes a live website.

💡 Example:

You can build an app that:

  • Takes user input
  • Runs a machine learning model
  • Shows a chart
  • All without knowing HTML, CSS, or JavaScript

👉 Think of it like PowerPoint for code, but interactive.


🚀 Why Use Streamlit? (With Examples & Pros/Cons)

Reason Explanation Real Example
⏱️ Fast Development Write 5–10 lines → get a working app Build a data viewer in 10 minutes
🧠 Easy with Data Science Works perfectly with Pandas, NumPy, Matplotlib Show a chart from a CSV file instantly
🖥️ Real-Time Reload Save code → app updates automatically No need to restart server
☁️ Easy to Deploy One click deploy on Streamlit Community Cloud Share your app with the world for free

✅ Pros (Advantages)

✔️ Why It’s Good
No frontend skills needed You don’t need to learn HTML/CSS/JS
Simple syntax Just use st.write(), st.button() etc.
Great for demos Perfect for showing your ML model to others
Free & open-source No cost to use or deploy
Built-in widgets Sliders, buttons, file upload — all ready

❌ Cons (Limitations)

What You Can’t Do Easily
Not for big websites Not for Facebook or Amazon-type sites
Limited design control Hard to make custom designs (like animations)
Runs one user at a time Not ideal for 10,000 users at once
Always shows code If someone views source, they see your logic

🎯 Best for: Prototypes, dashboards, school projects, ML demos
🚫 Not for: Large websites, e-commerce, mobile apps


📚 When Should You Use Streamlit?

Here are real-life situations where Streamlit shines:


1. Machine Learning Demo

You trained a model to predict house prices.

👉 Use Streamlit to:

  • Let user enter house size, location, bedrooms
  • Show predicted price
  • Display chart of similar houses

✅ No need to build a full website!


2. Data Dashboard

You have sales data in a CSV file.

👉 Use Streamlit to:

  • Upload the file
  • Show tables and charts
  • Add filters (e.g., "Show only 2023 data")

✅ Great for sharing with your team.


3. Classroom Project

You’re a student doing a data science project.

👉 Use Streamlit to:

  • Show your analysis
  • Let teacher interact with your code
  • Present live results

✅ Teachers love interactive apps!


4. Quick Prototype

You want to test an idea before building a full app.

👉 Use Streamlit to:

  • Build a mini version in 1 hour
  • Show it to your boss or client
  • Get feedback fast

✅ Save time and money.


5. Internal Tool

Your team needs a small tool to process data.

👉 Use Streamlit to:

  • Build a form to upload files
  • Clean data automatically
  • Download the result

✅ No need to hire a web developer.


🧰 When NOT to Use Streamlit?

Situation Why Not
Building a company website Use WordPress, React, or HTML
Making a mobile app Use Flutter, React Native
High-traffic app (10k+ users) Streamlit is slow under heavy load
Need login system or payments Streamlit doesn’t support this easily
Want full design control Streamlit has limited styling options

🆚 Streamlit vs Other Tools

Feature Streamlit Flask Django Gradio
Easy to learn ✅ Yes ❌ Medium ❌ Hard ✅ Yes
For ML apps ✅ Perfect ✅ Good ✅ Good ✅ Good
Design control ❌ Low ✅ High ✅ High ❌ Low
Deployment ✅ Very easy ✅ Medium ✅ Medium ✅ Easy
Best for beginners ✅ Yes ❌ No ❌ No ✅ Yes

Streamlit = Best for beginners & fast ML apps
Django/Flask = Best for full websites


🧪 Real Example: Simple App

Let’s build a tiny app that asks your name and greets you.

Step 1: Create app.py

import streamlit as st name = st.text_input("What is your name?") if name: st.write(f"Hello, {name}! 👋")

Step 2: Run it

streamlit run app.py

👉 Open browser → type your name → see greeting!

✅ You just built a web app!


🧭 Summary: Should You Learn Streamlit?

Yes, if you… No, if you…
Want to build apps fast Want to build big websites
Work with data or ML Need full design control
Are a beginner in coding Want to make mobile apps
Want to impress in school/job Need user login or payments

🙏 Final Words

Streamlit is not for everything, but it’s perfect for learning and fast projects.

🎯 If you know Python, you can build real apps today.

🚀 Start small. Build one app. Share it. Learn more.

You don’t need to be an expert. Just start.


🚶‍♂️ Step-by-Step Guide: How to Install Streamlit (For Absolute Beginners)

🎯 This guide is for non-technical learners.
No prior knowledge of coding or computers needed.
We’ll go step by step, like a recipe.


🧰 What You Need Before Starting

Before we begin, make sure you have:

Thing Why You Need It
A computer (Windows, Mac, or Linux) To run the apps
Internet connection To download tools
Basic typing skills To type simple commands

✅ That’s it! No special skills needed.


📦 Step 1: Install Python (The Brain of Streamlit)

Streamlit runs on Python — a programming language.
But don’t worry — you don’t need to learn all of Python.
Just install it, like installing any app.

🔹 For Windows Users

  1. Go to: https://www.python.org/downloads/
  2. Click the big yellow button: Download Python
  3. When the file downloads, double-click it
  4. In the installer:
    • ✅ Check: Add Python to PATH (very important!)
    • Click: Install Now
  5. Wait for it to finish
  6. Close the window

✅ Python is now installed!

💡 Tip: If you see a message about "security", click "Run anyway".


🔹 For Mac Users

  1. Go to: https://www.python.org/downloads/
  2. Click Download Python
  3. Open the downloaded file
  4. Double-click python-xxx.pkg
  5. Follow the steps and click "Continue" until done
  6. Wait and finish

✅ Python is now installed!


🔹 For Linux Users (Ubuntu/Debian)

Open Terminal (you can search for it in your apps).

Type these commands one by one:

sudo apt update

👉 Press Enter, type your password if asked.

sudo apt install python3 python3-pip -y

👉 This installs Python and a tool called pip.

Check if it worked:

python3 --version

👉 You should see something like Python 3.8 or higher.

✅ Python is now installed!


🔧 Step 2: Install pip (Only for Windows & Mac – Usually Already Exists)

pip is a tool that helps install libraries like Streamlit.

🔹 Check if pip is already installed

Open Command Prompt (Windows) or Terminal (Mac/Linux) and type:

pip --version

👉 If you see a version (like pip 23.0), great! You’re done.

👉 If you see "command not found", run this:

For Windows/Mac:

Download from: https://bootstrap.pypa.io/get-pip.py
Save the file as get-pip.py

Then in Command Prompt/Terminal, go to the folder where you saved it and run:

python get-pip.py

✅ Now pip is installed.


🌐 Step 3: Install Streamlit

Now we install Streamlit using pip.

In Command Prompt (Windows) or Terminal (Mac/Linux), type:

pip install streamlit

Wait for it to finish. You’ll see lines like:

Downloading streamlit... Installing collected packages: streamlit Successfully installed streamlit-1.29.0 

✅ Streamlit is now installed!


🧪 Step 4: Test Streamlit (Build Your First App!)

Let’s make a simple app to check if everything works.

Step 4.1: Create a New File

  1. Open Notepad (Windows) or TextEdit (Mac)
  2. Type this code:
import streamlit as st st.title("My First App") st.write("Hello! This is my first Streamlit app.")
  1. Save the file as: my_app.py
    • Save it on your Desktop
    • Make sure it ends with .py (not .txt)

💡 On Mac: In TextEdit, go to Format → Make Plain Text before saving.


Step 4.2: Run the App

Open Command Prompt (Windows) or Terminal (Mac/Linux).

Type:

cd Desktop

👉 This tells the computer: “Go to the Desktop”.

Then run:

streamlit run my_app.py

Wait a few seconds.

👉 A web browser will open automatically at http://localhost:8501

You should see:

  • A title: "My First App"
  • A message: "Hello! This is my first Streamlit app."

✅ Congratulations! You just built and ran your first web app!

🔁 To stop the app, go back to Command Prompt/Terminal and press Ctrl + C


📁 Where to Keep Your Files?

Create a folder called streamlit_apps on your Desktop.

Inside it, save all your .py files like:

  • my_app.py
  • data_viewer.py
  • ml_demo.py

This keeps everything organized.


🛠️ Common Problems & Fixes (For Beginners)

Problem Solution
streamlit is not recognized You forgot to install it. Run pip install streamlit again
App doesn’t open in browser Copy the link http://localhost:8501 and paste in Chrome/Firefox
File saves as .txt not .py In Notepad, choose "All Files" when saving, and write my_app.py
Python not found Make sure you checked Add Python to PATH during install
Slow internet Wait longer. It may take 2–5 minutes to install

🧩 What Did You Just Do? (Simple Explanation)

You Did What It Means
Installed Python Gave your computer the ability to run code
Ran pip install streamlit Added the Streamlit tool
Wrote a .py file Told the computer what to show
Ran streamlit run Turned your code into a live website

👉 Think of it like building a LEGO house:

  • Python = The LEGO base
  • Streamlit = The LEGO blocks
  • Your code = The instructions
  • The app = The finished house

🎁 Bonus: Try a Fun App

Replace the code in my_app.py with this:

import streamlit as st import random st.title("🎲 Dice Roller") if st.button("Roll Dice"): number = random.randint(1, 6) st.write(f"You rolled: {number}!") if number == 6: st.balloons() st.write("🎉 Yay! You got a six!")

Save and run:

streamlit run my_app.py

Click the button and see what happens!

✅ You just made an interactive game!


🙏 Final Words

You don’t need to be a tech expert to use Streamlit.
You just need to try, fail, fix, and try again.

🎯 Every coder starts exactly where you are now.

You did it!
🚀 Keep going. The next step is even more fun.


🚶‍♂️ Next Topics: Step-by-Step Guides for Beginners

🎯 This guide is for absolute beginners.
Just copy, paste, run — and see magic happen!


📌 How to Use This Guide

  1. Copy the code
  2. Paste into a new file
  3. Save it with .py extension
  4. Run the command in your terminal
  5. See the app in your browser

✅ All commands work on Windows, Mac, and Linux.


📘 Lecture 1: Basics of Streamlit

🎯 What You’ll Learn

  • Show text, titles, and code
  • Use st.write(), st.title(), st.code()

✅ Step 1: Create the File

Create a new file called 01_basics.py

👉 Copy and paste this code:

import streamlit as st # Show a big title st.title("My First Streamlit App") # Show normal text st.write("This is a simple text message.") # Show bold and italic text st.write("This is **bold** and *italic*.") # Show a code block code = ''' import pandas as pd df = pd.read_csv("data.csv") print(df.head()) ''' st.code(code, language="python") # Show a dictionary user = {"name": "Alice", "age": 25, "city": "Dhaka"} st.write(user)

✅ Step 2: Run the App

Open Terminal (Mac/Linux) or Command Prompt/PowerShell (Windows).

Run this command:

streamlit run 01_basics.py

👉 Your browser will open with your app!

✅ You should see:

  • A title
  • Some text
  • A code block
  • A dictionary

🔁 To stop: Press Ctrl + C in the terminal


📘 Lecture 2: Display Data (Tables & JSON)

🎯 What You’ll Learn

  • Show tables and JSON data
  • Use st.dataframe(), st.table(), st.json()

✅ Step 1: Create the File

Create a new file called 02_display_data.py

👉 Copy and paste this code:

import streamlit as st import pandas as pd import numpy as np # Create fake data df = pd.DataFrame({ "Name": ["Alice", "Bob", "Charlie", "Diana"], "Age": [24, 30, 28, 35], "City": ["Dhaka", "Delhi", "London", "NYC"] }) # Show as scrollable table st.dataframe(df) # Show as static table st.table(df) # Show a metric (like a KPI) st.metric("Total Users", value=4, delta="+1 new") # Show dictionary as JSON data = {"project": "Streamlit Course", "students": 100, "status": "active"} st.json(data, expanded=False)

✅ Step 2: Run the App

Run this command:

streamlit run 02_display_data.py

✅ You should see:

  • A scrollable table
  • A fixed table
  • A metric box
  • A collapsible JSON block

📘 Lecture 3: Charts & Maps

🎯 What You’ll Learn

  • Draw line, bar charts
  • Show locations on a map

✅ Step 1: Create the File

Create a new file called 03_charts.py

👉 Copy and paste this code:

import streamlit as st import pandas as pd import numpy as np # Create sample data chart_data = pd.DataFrame( np.random.randn(20, 3), columns=['A', 'B', 'C'] ) # Line chart st.subheader("Line Chart") st.line_chart(chart_data) # Bar chart st.subheader("Bar Chart") st.bar_chart(chart_data) # Map st.subheader("Map of Cities") places = pd.DataFrame({ "lat": [19.0760, 28.6139, 40.7128], # Mumbai, Delhi, NYC "lon": [72.8777, 77.2090, -74.0060] }) st.map(places)

✅ Step 2: Run the App

Run this command:

streamlit run 03_charts.py

✅ You should see:

  • A line chart
  • A bar chart
  • A map with 3 cities

📘 Lecture 4: Buttons & Widgets

🎯 What You’ll Learn

  • Use buttons, checkboxes, dropdowns

✅ Step 1: Create the File

Create a new file called 04_widgets.py

👉 Copy and paste this code:

import streamlit as st # Button if st.button("Click Me"): st.write("Button was clicked!") # Checkbox agree = st.checkbox("I agree to the terms") if agree: st.write("Thank you for agreeing!") # Radio button food = st.radio( "What would you like to eat?", ("Pizza", "Burger", "Salad") ) st.write(f"You selected: {food}") # Dropdown (selectbox) city = st.selectbox( "Where do you live?", ["Dhaka", "Delhi", "London", "Tokyo"] ) st.write(f"Your city: {city}")

✅ Step 2: Run the App

Run this command:

streamlit run 04_widgets.py

✅ You should see:

  • A button that shows text when clicked
  • A checkbox that reveals a message
  • A radio button and dropdown that respond to choices

📘 Lecture 5: Input Widgets (Sliders, Text, Numbers)

🎯 What You’ll Learn

  • Get input from users

✅ Step 1: Create the File

Create a new file called 05_input.py

👉 Copy and paste this code:

import streamlit as st # Slider age = st.slider("Your Age", 0, 100, 25) st.write(f"You are {age} years old.") # Text input name = st.text_input("Your Name", placeholder="Type your name") if name: st.write(f"Hello, {name}!") # Number input weight = st.number_input("Your Weight (kg)", min_value=30, max_value=200, value=60) st.write(f"Your weight: {weight} kg") # Multiselect hobbies = st.multiselect( "Your Hobbies", ["Music", "Sports", "Reading", "Cooking"], default=["Music"] ) st.write("You enjoy:", hobbies)

✅ Step 2: Run the App

Run this command:

streamlit run 05_input.py

✅ You should see:

  • A slider for age
  • A text box for name
  • A number input for weight
  • A multiselect for hobbies

📘 Lecture 6: File Upload & Camera

🎯 What You’ll Learn

  • Upload files and take photos

✅ Step 1: Create the File

Create a new file called 06_file_upload.py

👉 Copy and paste this code:

import streamlit as st # File uploader uploaded_file = st.file_uploader("Upload a text file", type=["txt"]) if uploaded_file: content = uploaded_file.read().decode("utf-8") st.write("File content:") st.text(content) # Camera input camera_photo = st.camera_input("Take a photo") if camera_photo: st.image(camera_photo, caption="Your photo")

📷 Note: Camera may not work on all devices (e.g., desktops without webcam)


✅ Step 2: Run the App

Run this command:

streamlit run 06_file_upload.py

✅ Try:

  • Uploading a .txt file
  • Taking a photo (if your device has a camera)

📘 Lecture 7: Show Images, Audio, Video

🎯 What You’ll Learn

  • Display media files

✅ Step 1: Prepare Files

Download these files and save them in the same folder:

Or skip if you don’t have them.


✅ Step 2: Create the File

Create a new file called 07_media.py

👉 Copy and paste this code:

import streamlit as st # Show image st.image("doggo.jpg", caption="A cute dog", width=400) # Play audio st.audio("audio.mp3", format="audio/mp3") # Play video st.video("video.mp4", format="video/mp4")

✅ Step 3: Run the App

Run this command:

streamlit run 07_media.py

✅ You should see:

  • An image
  • An audio player
  • A video player

🔁 If file not found: Make sure the files are in the same folder


📘 Lecture 8: Layouts (Sidebar, Columns, Tabs)

🎯 What You’ll Learn

  • Organize your app layout

✅ Step 1: Create the File

Create a new file called 08_layouts.py

👉 Copy and paste this code:

import streamlit as st # Sidebar with st.sidebar: st.header("Menu") choice = st.radio("Go to", ["Home", "Settings"]) # Columns col1, col2 = st.columns(2) col1.write("This is left column") col2.write("This is right column") # Tabs tab1, tab2 = st.tabs(["Info", "Data"]) tab1.write("Welcome to the Info tab!") tab2.write("Here is some data: 1, 2, 3, 4, 5") # Expander with st.expander("Click to see more"): st.write("This was hidden!")

✅ Step 2: Run the App

Run this command:

streamlit run 08_layouts.py

✅ You should see:

  • A sidebar with options
  • Two columns
  • Two tabs
  • A clickable expander

📘 Lecture 9: Progress & Effects

🎯 What You’ll Learn

  • Show loading, progress, fun effects

✅ Step 1: Create the File

Create a new file called 09_status.py

👉 Copy and paste this code:

import streamlit as st import time # Progress bar st.subheader("Progress Bar") progress = st.progress(0) for i in range(100): time.sleep(0.05) progress.progress(i + 1) # Spinner with st.spinner("Loading..."): time.sleep(3) st.success("Done!") # Fun effects st.balloons() st.snow()

✅ Step 2: Run the App

Run this command:

streamlit run 09_status.py

✅ You should see:

  • A progress bar that fills up
  • A spinner with "Loading..."
  • Balloons and snow animation

📦 Summary: All Files You Created

File Purpose
01_basics.py Show text and code
02_display_data.py Show tables and JSON
03_charts.py Draw charts and maps
04_widgets.py Buttons and choices
05_input.py Get user input
06_file_upload.py Upload files and photo
07_media.py Show image, audio, video
08_layouts.py Organize layout
09_status.py Show progress and effects

🙏 Final Words

You just built 9 working apps — all from scratch.
No magic. Just code. And you did it!

You don’t need to be a genius.
You just need to practice.

🎯 Keep going. The next step is even more fun.


📘 Lecture 10: Forms & Session Basics

🎯 What You’ll Learn

  • Group inputs in a form
  • Use st.form() and st.form_submit_button()
  • Show code with st.echo()

✅ Step 1: Create the File

Create a new file called 10_forms.py

👉 Copy and paste this code:

import streamlit as st # Form to collect user info with st.form("user_form"): name = st.text_input("Your Name") age = st.slider("Your Age", 18, 100, 25) email = st.text_input("Email Address") # This button submits the form submitted = st.form_submit_button("Submit") # Show result after submit if submitted: st.success(f"Thanks, {name}! We’ll send info to {email}.") st.write(f"Age: {age}") # Show some code nicely st.subheader("Code Example") with st.echo(): def greet(user): return f"Hello, {user}!" msg = greet("Alice") st.write(msg)

✅ Step 2: Run the App

Run this command in your terminal:

streamlit run 10_forms.py

✅ You should see:

  • A form with name, age, email
  • A submit button
  • After submit: a success message
  • A code block that shows itself (st.echo())

💡 Tip: st.echo() is great for teaching or showing your code live.


📘 Lecture 11: Dynamic Updates (Live Charts)

🎯 What You’ll Learn

  • Update charts in real time
  • Use add_rows() to add new data

✅ Step 1: Create the File

Create a new file called 11_dynamic.py

👉 Copy and paste this code:

import streamlit as st import pandas as pd import numpy as np import time # Initial data df = pd.DataFrame( np.random.randn(10, 2), columns=["Stock Price", "Volume"] ) # Show initial chart st.subheader("Live Stock Chart") chart = st.line_chart(df) # Add new data every second st.write("Updating chart...") for i in range(5): time.sleep(1) # Wait 1 second new_row = pd.DataFrame( np.random.randn(1, 2), columns=["Stock Price", "Volume"] ) chart.add_rows(new_row) # Add new point to chart st.balloons() st.write("Chart update complete!")

✅ Step 2: Run the App

Run this command:

streamlit run 11_dynamic.py

✅ You should see:

  • A line chart
  • It updates every second with new random points
  • Ends with balloons

📈 Use this for live data: sensors, stock prices, temperature


📘 Lecture 12: Session State (Remember User Input)

🎯 What You’ll Learn

  • Remember values even after button clicks
  • Use st.session_state

✅ Step 1: Create the File

Create a new file called 12_session.py

👉 Copy and paste this code:

import streamlit as st # Initialize counter if not exists if "counter" not in st.session_state: st.session_state.counter = 0 # Show current count st.write(f"Counter: {st.session_state.counter}") # Buttons to change counter if st.button("Add 1"): st.session_state.counter += 1 if st.button("Reset"): st.session_state.counter = 0 # Bonus: Use widget with key name = st.text_input("Save your name", key="user_name") if st.session_state.user_name: st.write(f"Hello again, {st.session_state.user_name}!")

✅ Step 2: Run the App

Run this command:

streamlit run 12_session.py

✅ You should see:

  • A counter that increases when you click "Add 1"
  • It remembers the count even after clicking other buttons
  • A text box that remembers your name

💡 Without st.session_state, Streamlit forgets everything on every click.


📘 Lecture 13: Caching (Speed Up Your App)

🎯 What You’ll Learn

  • Make your app faster
  • Use @st.cache_resource and @st.cache_data

✅ Step 1: Create the File

Create a new file called 13_caching.py

👉 Copy and paste this code:

import streamlit as st import time import pandas as pd import numpy as np # ❌ Slow function (without cache) def slow_function(): st.write("⏳ Loading data... (This takes time!)") time.sleep(3) return pd.DataFrame(np.random.randn(10, 2), columns=["A", "B"]) # ✅ Fast function (with cache) @st.cache_data def cached_function(): st.write("📦 Caching data...") time.sleep(3) return pd.DataFrame(np.random.randn(10, 2), columns=["A", "B"]) st.subheader("Without Cache") if st.button("Run Slow Function"): result = slow_function() st.dataframe(result) st.subheader("With Cache") if st.button("Run Cached Function"): result = cached_function() st.dataframe(result)

✅ Step 2: Run the App

Run this command:

streamlit run 13_caching.py

✅ Try:

  1. Click "Run Slow Function" → waits 3 seconds
  2. Click again → waits again
  3. Click "Run Cached Function" → waits 3 seconds
  4. Click again → instant result!

💡 @st.cache_data saves the result so it doesn’t run again.


🧠 Bonus: When to Use Caching?

Use Case Which Decorator
Load a big CSV file @st.cache_data
Load a machine learning model @st.cache_resource
Process data (e.g., clean CSV) @st.cache_data
Connect to database @st.cache_resource

🔹 @st.cache_data → for data (CSV, lists, DataFrames)
🔹 @st.cache_resource → for heavy objects (models, connections)


📦 Summary: All 13 Lectures Done!

File Purpose
01_basics.py Text, titles, code
02_display_data.py Tables, JSON
03_charts.py Charts and maps
04_widgets.py Buttons, checkboxes
05_input.py Sliders, text input
06_file_upload.py Upload files, camera
07_media.py Image, audio, video
08_layouts.py Sidebar, columns, tabs
09_status.py Progress, spinner, balloons
10_forms.py Forms and echo code
11_dynamic.py Live-updating chart
12_session.py Remember values
13_caching.py Speed up app

🚀 Mini Project: Build a BMI Calculator

Let’s combine what you’ve learned!

Create a file: bmi_calculator.py

import streamlit as st st.title("🧮 BMI Calculator") # Input height = st.slider("Height (cm)", 100, 250, 170) weight = st.slider("Weight (kg)", 30, 200, 70) # Calculate bmi = weight / ((height / 100) ** 2) # Show result st.subheader(f"Your BMI: {bmi:.2f}") # Give feedback if bmi < 18.5: st.warning("Underweight") elif bmi < 25: st.success("Normal weight") elif bmi < 30: st.warning("Overweight") else: st.error("Obese")

Run it:

streamlit run bmi_calculator.py

✅ You just built a real tool!


🙏 Final Words

You started with zero.
Now you’ve built 13 apps + 1 project.
You’re no longer a beginner.

🎯 Keep building:

  • A to-do list
  • A quiz app
  • A data viewer for CSV files

You can do this.
🚀 Just keep coding.


📘 Project 1: CSV Data Viewer App

🎯 What You’ll Learn

  • Let user upload a CSV file
  • Show data and basic stats
  • Make a simple data explorer

✅ Step 1: Create the File

Create a new file called csv_viewer.py

👉 Copy and paste this code:

import streamlit as st import pandas as pd st.title("📂 CSV Data Viewer") # Upload CSV file uploaded = st.file_uploader("Upload your CSV file", type=["csv"]) if uploaded: # Read the file df = pd.read_csv(uploaded) # Show data st.subheader("Data Preview") st.dataframe(df.head(10)) # Show first 10 rows # Show basic info st.subheader("Basic Info") st.write(f"Total Rows: {df.shape[0]}") st.write(f"Total Columns: {df.shape[1]}") st.write("Column Names:", list(df.columns)) # Show data types st.subheader("Data Types") st.write(df.dtypes) # Show chart (if numeric columns exist) numeric_cols = df.select_dtypes(include=['number']).columns if len(numeric_cols) > 0: st.subheader("Chart of First Numeric Column") st.line_chart(df[numeric_cols[0]].head(20)) else: st.info("No numeric data to chart.")

✅ Step 2: Run the App

Run this command in your terminal:

streamlit run csv_viewer.py

✅ How to test:

  1. Find any CSV file (e.g., Excel saved as .csv)
  2. Or create one: data.csv
    Name,Age,Score Alice,24,85 Bob,30,92 Charlie,28,78 
  3. Upload it in the app

✅ You should see:

  • Table preview
  • Row/column count
  • Data types
  • A line chart (if numbers exist)

📘 Project 2: Simple To-Do List App

🎯 What You’ll Learn

  • Save user input using st.session_state
  • Add and clear tasks

✅ Step 1: Create the File

Create a new file called todo_app.py

👉 Copy and paste this code:

import streamlit as st st.title("📝 Simple To-Do List") # Initialize session state for tasks if "tasks" not in st.session_state: st.session_state.tasks = [] # Input to add new task new_task = st.text_input("Add a new task:") if st.button("Add Task") and new_task: st.session_state.tasks.append(new_task) st.success(f"Task added: {new_task}") # Show all tasks if st.session_state.tasks: st.subheader("Your Tasks") for i, task in enumerate(st.session_state.tasks): st.write(f"{i+1}. {task}") else: st.info("No tasks yet. Add one above!") # Clear all tasks if st.button("Clear All Tasks"): st.session_state.tasks = [] st.warning("All tasks cleared!")

✅ Step 2: Run the App

Run this command:

streamlit run todo_app.py

✅ Try:

  • Type a task and click "Add Task"
  • See it appear in the list
  • Click "Clear All" to reset

✅ This app remembers your tasks even after adding new ones!


📘 Project 3: Quiz App (Yes/No Questions)

🎯 What You’ll Learn

  • Use radio buttons for choices
  • Track score
  • Show final result

✅ Step 1: Create the File

Create a new file called quiz_app.py

👉 Copy and paste this code:

import streamlit as st st.title("🧠 Simple Quiz App") # Questions and answers questions = [ { "q": "Is Python a programming language?", "options": ["Yes", "No"], "correct": "Yes" }, { "q": "Does Streamlit need HTML?", "options": ["Yes", "No"], "correct": "No" }, { "q": "Can you deploy Streamlit for free?", "options": ["Yes", "No"], "correct": "Yes" } ] # Start quiz st.write("Answer the questions below:") score = 0 for i, qa in enumerate(questions): st.subheader(f"Question {i+1}: {qa['q']}") answer = st.radio(f"Choose:", qa["options"], key=f"q{i}") if answer == qa["correct"]: score += 1 # Show result if st.button("Submit Quiz"): st.subheader(f"Your Score: {score} / {len(questions)}") if score == len(questions): st.balloons() st.success("🎉 Perfect! You're a Streamlit pro!") elif score >= 2: st.success("Good job! Keep learning.") else: st.warning("Keep practicing. You'll get better!")

✅ Step 2: Run the App

Run this command:

streamlit run quiz_app.py

✅ Try:

  • Answer all questions
  • Click "Submit Quiz"
  • See your score and feedback

✅ Great for teaching or self-testing!


📘 Project 4: Temperature Converter

🎯 What You’ll Learn

  • Convert between Celsius and Fahrenheit
  • Use selectbox and number_input

✅ Step 1: Create the File

Create a new file called temp_converter.py

👉 Copy and paste this code:

import streamlit as st st.title("🌡️ Temperature Converter") # Choose conversion type conversion = st.selectbox( "Convert from:", ["Celsius to Fahrenheit", "Fahrenheit to Celsius"] ) # Input temperature temp = st.number_input("Enter temperature:", value=0.0) # Convert if conversion == "Celsius to Fahrenheit": result = (temp * 9/5) + 32 st.write(f"**{temp}°C = {result:.1f}°F**") else: result = (temp - 32) * 5/9 st.write(f"**{temp}°F = {result:.1f}°C**") # Add a fun message if temp > 100: st.warning("That's boiling hot!") elif temp < 0: st.info("Below freezing!")

✅ Step 2: Run the App

Run this command:

streamlit run temp_converter.py

✅ Try:

  • Enter 0°C → should give 32°F
  • Enter 100°C → should give 180°F
  • See fun messages at extremes

📘 Project 5: Feedback Form App

🎯 What You’ll Learn

  • Build a form with multiple inputs
  • Collect and display feedback

✅ Step 1: Create the File

Create a new file called feedback_form.py

👉 Copy and paste this code:

import streamlit as st st.title("📬 Feedback Form") with st.form("feedback_form"): name = st.text_input("Your Name") rating = st.slider("Rate us (1-5)", 1, 5, 3) comments = st.text_area("Your Comments") submitted = st.form_submit_button("Submit") if submitted: st.success("Thank you for your feedback!") st.write(f"**Name:** {name}") st.write(f"**Rating:** {rating} ⭐") st.write(f"**Comments:** {comments}")

✅ Step 2: Run the App

Run this command:

streamlit run feedback_form.py

✅ Try:

  • Fill out the form
  • Click "Submit"
  • See your feedback displayed

✅ Perfect for surveys or class projects!


📦 Summary: 5 New Apps You Built

App Skills Used
csv_viewer.py File upload, pandas, charts
todo_app.py Session state, list management
quiz_app.py Loops, scoring, radio buttons
temp_converter.py Math, selectbox, conditions
feedback_form.py Forms, text area, feedback display

🚀 What’s Next?

Now that you can build real apps:

1. Customize These Apps

  • Change colors (use st.success, st.warning)
  • Add your logo: st.image("logo.jpg")
  • Save data to file (advanced)

2. Combine Features

  • Add a to-do list inside a sidebar
  • Let user upload CSV and chart it
  • Build a dashboard with tabs

3. Deploy for Free

Go to: https://share.streamlit.io/
Connect your GitHub and deploy any app in 2 minutes.


🙏 Final Words

You started with print("Hello").
Now you’re building real apps that solve problems.

🎯 Keep going:

  • Teach a friend
  • Build an app for your school/work
  • Share on social media

You are now a Streamlit developer.

🚀 The only next step is to keep building.


🚶‍♂️ Next Topic: Build a Personal Portfolio App

🎯 This is a real-world project that combines everything you've learned.
You’ll build a personal portfolio website — like a mini LinkedIn or resume site.
Perfect for students, freelancers, or job seekers.


🎯 What You’ll Learn

  • Use tabs to organize content
  • Show images, text, and links
  • Add contact form
  • Deploy it online (free)

✅ No HTML/CSS needed. Just Python + Streamlit.


📁 Folder Setup (Keep It Clean)

Create a folder called my_portfolio/ and inside:

my_portfolio/ ├── app.py ← Your main app ├── profile.jpg ← Your photo (download any if you don’t have) 

👉 You can download a sample image here:
https://picsum.photos/400/500 → Right-click → Save as profile.jpg


✅ Step 1: Create the File

Create a file called app.py inside the my_portfolio folder.

👉 Copy and paste this full code:

import streamlit as st # Page config st.set_page_config( page_title="My Portfolio", page_icon="👨‍💻", layout="centered" ) # Title & Profile st.title("👨‍💻 My Portfolio") st.subheader("Hi, I'm Alice!") st.write("A passionate learner and future developer.") # Profile Image st.image("profile.jpg", width=200, caption="That's me!") # Info Section st.write("---") # Line divider st.subheader("About Me") st.write(""" I am a student from Bangladesh.  I love coding, data science, and building small apps.  Currently learning Streamlit to create interactive projects. """) # Skills st.subheader("Skills") skills = ["Python", "Streamlit", "Pandas", "Data Analysis", "Basic ML"] for skill in skills: st.markdown(f"- {skill}") # Projects st.write("---") st.subheader("Projects") projects = [ {"name": "CSV Viewer", "desc": "Upload and view CSV files"}, {"name": "To-Do List", "desc": "Simple task manager with session state"}, {"name": "Quiz App", "desc": "Interactive quiz with scoring"} ] for proj in projects: st.write(f"**{proj['name']}**: {proj['desc']}") # Contact Form st.write("---") st.subheader("Contact Me") with st.form("contact_form"): name = st.text_input("Your Name") email = st.text_input("Your Email") message = st.text_area("Your Message") submitted = st.form_submit_button("Send Message") if submitted: st.success("Thank you! I'll get back to you soon.") # In real app, you'd send email (advanced) st.write(f"Name: {name}") st.write(f"Email: {email}") st.write(f"Message: {message}") # Footer st.write("---") st.write("🔗 Find me on: [GitHub](https://github.com/yourusername) | [LinkedIn](https://linkedin.com/in/yourprofile)") st.write("📧 Email: you@example.com") st.write("Built with ❤️ using Streamlit")

✅ Step 2: Run the App

Open your terminal, go to the my_portfolio folder, and run:

streamlit run app.py

✅ You should see:

  • Your photo
  • About section
  • Skills and projects
  • Contact form
  • Links at the bottom

🔁 Press Ctrl + C in terminal to stop the app


🔍 Code Breakdown (Simple Explanation)

Part What It Does
st.set_page_config() Sets tab title, icon, and layout
st.image() Shows your photo
st.write("---") Draws a horizontal line
for skill in skills: Loops through list and shows each item
with st.form() Groups inputs and adds a submit button
[GitHub](link) Makes clickable link (Markdown syntax)

💡 This app uses:

  • Text display
  • Images
  • Lists
  • Forms
  • Links
  • Clean layout

🛠️ How to Customize It (Easy Edits)

1. Change Your Info

Find:

st.subheader("Hi, I'm Alice!")

Replace with:

st.subheader("Hi, I'm [Your Name]!")

2. Add Your Photo

Save your photo as profile.jpg in the same folder.

Or change the filename:

st.image("my_photo.jpg", width=200, caption="Me")

3. Add More Sections

Want an "Education" section? Add:

st.write("---") st.subheader("Education") st.write(""" - BSc in Computer Science – XYZ University (2024) - High School – ABC School (2020) """)

4. Add Social Icons

Replace the links with your real profiles:

st.write("🔗 Find me on: [GitHub](https://github.com/yourname) | [Twitter](https://twitter.com/yourhandle)")

🚀 Bonus: Add a Download Button for Resume

If you have a resume file (resume.pdf), add this:

# Download Resume with open("resume.pdf", "rb") as f: st.download_button( label="📄 Download My Resume", data=f, file_name="my_resume.pdf", mime="application/pdf" )

✅ Make sure resume.pdf is in the same folder.

Now users can download your resume!


🌐 How to Deploy This App for Free

Want to share your portfolio with the world?

  1. Sign in with GitHub
  2. Click "New App"
  3. Connect your GitHub repo
  4. Upload these files:
    • app.py
    • profile.jpg
    • requirements.txt (see below)

Step 2: Create requirements.txt

Create a file called requirements.txt:

streamlit==1.29.0 pandas==2.1.0

This tells Streamlit what to install.

✅ In 2 minutes, your app will be live at a link like:
👉 https://yourname.streamlit.app


📦 Final Folder Structure

my_portfolio/ ├── app.py ├── profile.jpg ├── resume.pdf ← optional └── requirements.txt 

🙏 Final Words

You just built a real portfolio website — no web developer needed.

🎯 This app can:

  • Show your skills
  • Display your projects
  • Let people contact you
  • Be shared in job applications

You are now building real tools.

🚀 The next step?
Deploy it. Share it. Be proud.


🚶‍♂️ Next Topic: How to Debug Common Streamlit Errors

🎯 You’ve built apps. Now let’s fix common mistakes — the right way.
No panic. No confusion. Just simple fixes.
Perfect for beginners who see errors and think: “What now?”


🛠️ Why This Matters

Even expert coders make mistakes.
The key is not to avoid errors, but to understand and fix them fast.

In this guide, you’ll learn:

  • How to read error messages
  • Fix 7 most common Streamlit errors
  • Use tools to prevent bugs
  • Keep your app running smoothly

✅ All examples are copy-paste friendly.


🧰 Rule #1: Always Look at the Red Text

When your app crashes, Streamlit shows red error messages in the browser and terminal.

👉 Read the last few lines — that’s where the real problem is.


❌ Error 1: ModuleNotFoundError: No module named 'streamlit'

📌 Cause

Streamlit is not installed.

💡 Fix

Run this command in your terminal:

pip install streamlit

✅ Wait for it to say "Successfully installed".

Then run your app again:

streamlit run app.py

🔁 If you get pip: command not found, try pip3 install streamlit


❌ Error 2: File "app.py", line 5, NameError: name 'st' is not defined

📌 Cause

You forgot to import Streamlit.

💡 Fix

Add this line at the top of your file:

import streamlit as st

👉 Wrong code:

st.write("Hello") # ❌ No import!

👉 Correct code:

import streamlit as st # ✅ Add this! st.write("Hello")

✅ Always start your file with:

import streamlit as st

❌ Error 3: File not found: 'profile.jpg'

📌 Cause

The file is missing or in the wrong folder.

💡 Fix

Make sure:

  1. The file exists (profile.jpg)
  2. It’s in the same folder as your .py file

👉 Example folder:

my_app/ ├── app.py ├── profile.jpg ← must be here! 

Or use the correct path:

st.image("images/profile.jpg") # if inside images/ folder

✅ Tip: Right-click the file → "Copy path" to check.


❌ Error 4: st.button() did not work after input

📌 Cause

Streamlit reruns the whole script every time you click or type.

So if you type something, the button resets.

💡 Fix

Use st.session_state to remember values.

👉 Wrong code:

clicked = st.button("Click me") if clicked: st.write("Button was clicked!") # But it resets when you type in a text box

👉 Correct code:

import streamlit as st if "clicked" not in st.session_state: st.session_state.clicked = False if st.button("Click me"): st.session_state.clicked = True if st.session_state.clicked: st.success("Button was clicked and remembered!")

✅ Now the click is remembered even after typing.


❌ Error 5: st.pyplot() deprecated warning

📌 Cause

Old way of showing Matplotlib plots.

💡 Fix

Use st.pyplot(fig) with fig argument.

👉 Wrong code:

import matplotlib.pyplot as plt plt.plot([1, 2, 3]) st.pyplot() # ❌ Warning!

👉 Correct code:

import streamlit as st import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot([1, 2, 3]) st.pyplot(fig) # ✅ Correct!

✅ Always pass fig to st.pyplot().


❌ Error 6: text_input() doesn’t keep value

📌 Cause

Streamlit forgets input after every interaction.

💡 Fix

Use key to save input in st.session_state.

👉 Wrong code:

name = st.text_input("Name") st.write(f"Hello {name}") # Becomes empty when you do other actions

👉 Correct code:

name = st.text_input("Name", key="user_name") if st.session_state.user_name: st.write(f"Hello, {st.session_state.user_name}!")

✅ The key links the input to session state.


❌ Error 7: App runs but nothing shows

📌 Cause

No st.write() or display command.

💡 Fix

Add output commands.

👉 Wrong code:

import streamlit as st x = 10 y = 20 z = x + y # No output shown

👉 Correct code:

import streamlit as st x = 10 y = 20 z = x + y st.write(f"Result: {z}") # ✅ Now it shows

✅ Streamlit only shows what you tell it to show.


🧪 Practice: Debug This Broken App

Let’s fix a real broken app together.

✅ Step 1: Create broken_app.py

👉 Copy and paste this broken code:

# This app has 4 errors. Can you fix them? # 1. Missing import # 2. File not found # 3. Button not working # 4. No output shown name = st.text_input("Enter your name") if st.button("Greet Me"): st.write("Hello " + name) st.image("my_photo.jpg") # photo doesn't exist

✅ Step 2: Run It

Run:

streamlit run broken_app.py

👉 You’ll see errors.


✅ Step 3: Fix It (Correct Code)

Create a new file: fixed_app.py

👉 Copy and paste this fixed version:

import streamlit as st # ✅ Fixed: Added import # ✅ Fixed: Initialize session state if "greeted" not in st.session_state: st.session_state.greeted = False name = st.text_input("Enter your name", key="user_name") # ✅ Saved in session if st.button("Greet Me"): st.session_state.greeted = True # ✅ Fixed: Show output only if name exists if st.session_state.greeted and st.session_state.user_name: st.success(f"Hello, {st.session_state.user_name}! 👋") # ✅ Fixed: Use a working image (or comment out) # st.image("my_photo.jpg") # Removed or replace with valid file st.write("🖼️ No image for now — but app works!")

✅ Step 4: Run the Fixed App

Run:

streamlit run fixed_app.py

✅ Now it works!


🧰 Pro Tips to Avoid Bugs

Tip How
✅ Always start with import streamlit as st First line of every file
✅ Use key for inputs st.text_input("Name", key="name")
✅ Test one feature at a time Don’t write 100 lines at once
✅ Use st.write() to debug Print values to see what’s happening
✅ Save files in the same folder No broken image/audio errors

🚨 When in Doubt: Restart!

If your app acts weird:

  1. Press Ctrl + C in terminal
  2. Close browser tab
  3. Run again:
streamlit run app.py

✅ Fresh start fixes many issues.


🙏 Final Words

Errors are not your enemy.
They are your teachers.

🎯 Every coder sees red messages.
✅ The difference? They read, fix, and move on.

Now you can too.

🚀 Keep building. Keep breaking. Keep fixing.


🎉 10 Fun Mini App Ideas to Build Next

✅ Step-by-Step Guides for Beginners – Copy, Paste, Run

🎯 You’ve learned Streamlit. Now let’s build fun, small apps that feel like games or tools.
Each one takes 10–15 minutes.
All are copy-paste friendly and perfect for practice.


🎯 Rules for This Section

  • ✅ Copy the code
  • ✅ Save as .py file
  • ✅ Run with streamlit run filename.py
  • ✅ Change colors, text, or features to make it yours!

🎮 App 1: Random Number Generator

🎯 What it does: Click a button → get a random number.

✅ Create random_number.py

import streamlit as st import random st.title("🎲 Random Number Generator") if st.button("Generate Number"): num = random.randint(1, 100) st.subheader(f"Your number: {num}") if num > 90: st.balloons() st.success("Wow! A high number!") elif num < 10: st.info("Small but mighty!")

▶️ Run it:

streamlit run random_number.py

💡 Try: Change range to 1-10 or add sound?


🧠 App 2: Simple Math Quiz

🎯 What it does: Asks a math question, checks answer.

✅ Create math_quiz.py

import streamlit as st import random st.title("🧮 Math Quiz") # Generate question if "question" not in st.session_state: a = random.randint(1, 10) b = random.randint(1, 10) st.session_state.question = f"What is {a} + {b}?" st.session_state.answer = a + b # Show question st.write(st.session_state.question) # User input user_ans = st.number_input("Your answer:", step=1) # Check answer if st.button("Check"): if user_ans == st.session_state.answer: st.success("✅ Correct!") st.balloons() else: st.error(f"❌ Wrong! Answer was {st.session_state.answer}") # New question if st.button("New Question"): st.session_state.clear() # Reset st.experimental_rerun()

▶️ Run it:

streamlit run math_quiz.py

💡 Try: Add subtraction or multiplication.


🎭 App 3: Magic 8-Ball Fortune Teller

🎯 What it does: Ask a yes/no question → get a random fortune.

✅ Create magic_8ball.py

import streamlit as st import random st.title("🔮 Magic 8-Ball") question = st.text_input("Ask a yes/no question:") responses = [ "Yes, definitely!", "No way.", "Ask again later.", "Very doubtful.", "Signs point to yes.", "Absolutely not.", "Maybe, maybe not.", "Without a doubt!" ] if st.button("Shake the Ball"): if question: answer = random.choice(responses) st.subheader(f"🎱: {answer}") st.snow() else: st.warning("Please ask a question first!")

▶️ Run it:

streamlit run magic_8ball.py

💡 Try: Add your own funny responses!


📝 App 4: Note-Taking App

🎯 What it does: Save and view notes using session state.

✅ Create notes_app.py

import streamlit as st st.title("📝 Simple Notes App") # Initialize notes if "notes" not in st.session_state: st.session_state.notes = [] # Add new note new_note = st.text_area("Write a note:") if st.button("Save Note") and new_note: st.session_state.notes.append(new_note) st.success("Note saved!") st.experimental_rerun() # Show all notes if st.session_state.notes: st.subheader("Your Notes") for i, note in enumerate(st.session_state.notes): st.text(f"{i+1}. {note}") else: st.info("No notes yet.")

▶️ Run it:

streamlit run notes_app.py

💡 Try: Add a "Clear All" button.


🎵 App 5: Music Mood Picker

🎯 What it does: Pick a mood → suggest a song.

✅ Create music_mood.py

import streamlit as st st.title("🎵 Music Mood Picker") mood = st.radio( "How do you feel?", ["Happy", "Sad", "Chill", "Energetic"] ) songs = { "Happy": "Pharrell Williams - Happy", "Sad": "Adele - Someone Like You", "Chill": "Lofi Hip Hop Radio - Beats to Relax/Study", "Energetic": "Eye of the Tiger - Survivor" } if st.button("Recommend Song"): st.write(f"🎧 Play: **{songs[mood]}**") st.info("Open YouTube and search for this song!")

▶️ Run it:

streamlit run music_mood.py

💡 Try: Add links using [Song](https://youtube.com).


🐶 App 6: Pet Name Generator

🎯 What it does: Pick pet type → get random name.

✅ Create pet_names.py

import streamlit as st import random st.title("🐾 Pet Name Generator") pet = st.selectbox("Choose pet:", ["Dog", "Cat", "Bird", "Fish"]) names = { "Dog": ["Buddy", "Max", "Bella", "Lucy", "Rocky"], "Cat": ["Whiskers", "Luna", "Milo", "Chloe", "Leo"], "Bird": ["Polly", "Sky", "Rio", "Tweety", "Blue"], "Fish": ["Bubbles", "Nemo", "Finley", "Splash", "Goldie"] } if st.button("Generate Name"): name = random.choice(names[pet]) st.subheader(f"Your {pet}'s name: **{name}** 🎉") st.balloons()

▶️ Run it:

streamlit run pet_names.py

💡 Try: Add more pets or names.


🌡️ App 7: Weather Advisor

🎯 What it does: Enter temperature → get clothing advice.

✅ Create weather_advisor.py

import streamlit as st st.title("🌤️ Weather Advisor") temp = st.slider("Current Temperature (°C)", -10, 50, 25) if temp < 0: advice = "🧣 Wear heavy coat! It's freezing!" st.cold = st.image("https://i.imgur.com/pGdLw0A.png", width=100) # Optional elif temp < 15: advice = "🧥 Wear a jacket." elif temp < 25: advice = "👕 Light clothes are fine." else: advice = "☀️ Stay cool! Wear shorts and drink water." st.subheader(advice)

▶️ Run it:

streamlit run weather_advisor.py

💡 Try: Add humidity or rain input.


🎲 App 8: Dice Roller

🎯 What it does: Roll 1–6 dice and show results.

✅ Create dice_roller.py

import streamlit as st import random st.title("🎲 Dice Roller") num_dice = st.slider("How many dice?", 1, 6, 2) if st.button("Roll Dice"): results = [random.randint(1, 6) for _ in range(num_dice)] st.subheader(f"Results: {results}") total = sum(results) st.write(f"**Total: {total}**") if 6 in results: st.balloons() st.success("🎉 You rolled a six!")

▶️ Run it:

streamlit run dice_roller.py

💡 Try: Add images of dice faces.


🧩 App 9: Password Generator

🎯 What it does: Generate a simple random password.

✅ Create password_gen.py

import streamlit as st import random import string st.title("🔐 Password Generator") length = st.slider("Password length", 6, 16, 8) if st.button("Generate Password"): chars = string.ascii_letters + string.digits + "!@#$" password = ''.join(random.choice(chars) for _ in range(length)) st.subheader(f"Your password: `{password}`") st.warning("Don’t use this for real accounts! Just for fun.")

▶️ Run it:

streamlit run password_gen.py

💡 Try: Add checkbox for "include symbols".


📊 App 10: Poll App (Vote for Favorite Fruit)

🎯 What it does: Let users vote and see results.

✅ Create poll_app.py

import streamlit as st st.title("📊 Favorite Fruit Poll") # Initialize votes if "votes" not in st.session_state: st.session_state.votes = {"Apple": 0, "Banana": 0, "Orange": 0} # Vote choice = st.radio("Choose your favorite:", list(st.session_state.votes.keys())) if st.button("Vote"): st.session_state.votes[choice] += 1 st.success("Thanks for voting!") # Show results st.subheader("Live Results") for fruit, count in st.session_state.votes.items(): st.write(f"{fruit}: {count} votes")

▶️ Run it:

streamlit run poll_app.py

💡 Try: Add a bar chart of results.


🏆 Summary: 10 Apps You Can Build

App Skills Used
1. Random Number random, button
2. Math Quiz session_state, logic
3. Magic 8-Ball list, random, snow
4. Notes App session_state, text_area
5. Music Mood radio, dict
6. Pet Names selectbox, list
7. Weather Advisor slider, if-else
8. Dice Roller list comprehension, sum
9. Password Gen string, random
10. Poll App session_state, counting

🚀 What’s Next?

Now that you’ve built 10 fun apps:

  1. Pick your favorite and improve it
  2. Combine two apps (e.g., quiz + timer)
  3. Share it on social media or with friends
  4. Deploy it on Streamlit Community Cloud

🙏 Final Words

You started with print("Hello").
Now you’re building apps people want to use.

🎯 Keep coding.
🎮 Keep having fun.
🚀 Keep sharing.

You’re not just learning Streamlit.
You’re becoming a creator.


🎉 Congratulations! You’ve completed the full course.
👉 Now go build something amazing.


🚀 Final Advice

  • 📅 Spend 30 minutes daily on one lecture
  • ✍️ Type the code yourself (don’t copy-paste)
  • Break things on purpose (then fix them)
  • 🤝 Share your app with friends

📚 Resources

Link What It’s For
docs.streamlit.io Official Docs
Streamlit Gallery See real apps
Streamlit Community Ask questions
GitHub Repo of this Course Your own repo

🙏 Final Words

You don’t need to be an expert to start.
Just start.
Every expert was once a beginner.

✅ You now have a complete, step-by-step, beginner-friendly guide to learn Streamlit from zero.

🎯 Go ahead. Run your first app. Break it. Fix it. Build something cool.


If you liked this guide, give your repo a Star!
👨‍💻 Happy Coding!
🚀 You’ve got this!

About

✔Streamlit is an open-source Python framework for data scientists and AI/ML engineers to deliver interactive data apps – in only a few lines of code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published