DEV Community

Mene.tech
Mene.tech

Posted on

✨ Build a Simple Quote Generator in Python (No Stress, Just Vibes)

Hi! I’m Mene a writer, developer, and curious human who believes code doesn’t have to be complicated before it’s powerful.

This is one of those mini Python projects I built on a quiet afternoon

In this post, I’ll show you how to build a simple quote generator with Python.

🔧 What You’ll Need

  • Python installed (3.x)
  • A code editor (VS Code works fine)
  • Your brain (charged or slightly tired — both work)

🧾 Step 1: Collect a Few Quotes

We're keeping it simple. No need to overthink. Just throw in the quotes that speak to you.



quotes = [
    "Believe you can and you're halfway there. – Theodore Roosevelt",
    "Your time is limited, so don’t waste it living someone else’s life. – Steve Jobs",
    "I have not failed. I've just found 10,000 ways that won't work. – Thomas Edison",
    "You miss 100% of the shots you don’t take. – Wayne Gretzky",
    "In the middle of difficulty lies opportunity. – Albert Einstein"
]


Enter fullscreen mode Exit fullscreen mode

🎲 Step 2: Pick One at Random

Python’s random module is like that friend who always surprises you — let’s use it to pick a quote.

import random

def get_random_quote():
    return random.choice(quotes)


Enter fullscreen mode Exit fullscreen mode

🎤 Step 3: Say It With Style

Now, let’s make the output feel less like code, and more like a whisper from the universe.


def display_quote():
    quote = get_random_quote()
    print("\n✨ Your Quote of the Moment ✨")
    print("--------------------------------")
    print(quote)
    print("--------------------------------\n")

Enter fullscreen mode Exit fullscreen mode

🔁 Step 4: Let the Vibes Keep Coming

Instead of quitting after one quote, let’s allow the user to keep generating more (until they say stop):


def run_quote_generator():
    while True:
        display_quote()
        choice = input("Press Enter to see another quote or type 'q' to quit: ").lower()
        if choice == 'q':
            print("Goodbye! Stay inspired ✨")
            break

Enter fullscreen mode Exit fullscreen mode

🔚 Full Code — No Missing Pieces


import random

quotes = [
    "Believe you can and you're halfway there. – Theodore Roosevelt",
    "Your time is limited, so don’t waste it living someone else’s life. – Steve Jobs",
    "I have not failed. I've just found 10,000 ways that won't work. – Thomas Edison",
    "You miss 100% of the shots you don’t take. – Wayne Gretzky",
    "In the middle of difficulty lies opportunity. – Albert Einstein"
]

def get_random_quote():
    return random.choice(quotes)

def display_quote():
    quote = get_random_quote()
    print("\n✨ Your Quote of the Moment ✨")
    print("--------------------------------")
    print(quote)
    print("--------------------------------\n")

def run_quote_generator():
    while True:
        display_quote()
        choice = input("Press Enter to see another quote or type 'q' to quit: ").lower()
        if choice == 'q':
            print("Goodbye! Stay inspired ✨")
            break

run_quote_generator()

Enter fullscreen mode Exit fullscreen mode

🔥 What Else You Can Try

If you want to spice it up:

  • Load quotes from a .txt or .json file
  • Use an API like Quotable
  • Turn this into a GUI using Tkinter
  • Build a web version with Flask and deploy on #Replit

🎈 Final Words

Small projects like this teach you a lot: how to write clean functions, interact with users, and structure logic. More importantly, they give you joy.

If this made you smile (or you ended up quoting Einstein on your WhatsApp), share it around or connect with me on Dev.to and Twitter

Code is not always about solving big problems. Sometimes, it’s about creating small moments.

Top comments (0)