DEV Community

Cover image for Day 27 of My 90 Days Python Series β€” Random Fun Fact Generator πŸš€
momina raheel (Moona)
momina raheel (Moona)

Posted on

Day 27 of My 90 Days Python Series β€” Random Fun Fact Generator πŸš€

🧠 Day 27 of My 90 Days Python Series β€” Random Fun Fact Generator πŸš€

Ever get stuck in tutorial loops and forget to have fun with code?

Well, today’s project is light, quick, and guaranteed to make you smile.


✨ What I Built

I created a Fun Fact Generator β€” a simple Python program that gives you a random fun fact every time you run it. Just press Enter… and boom, a fun fact appears on your screen.

This is perfect for:

  • Practicing loops and list handling in Python 🐍
  • Beginners who want to build something hands-on
  • Adding a creative break in your coding journey

🧰 Tools & Concepts Used

  • random.choice()
  • Lists
  • while loops
  • Input handling

πŸ§ͺ How It Works

  1. A list stores all the fun facts.
  2. The program picks a random one.
  3. It displays it to you.
  4. Repeats until you type exit.

Here’s a small example:


python
import random

fun_facts = [
    "Bananas are berries, but strawberries aren't!",
    "Octopuses have three hearts.",
    "Butterflies taste with their feet.",
    "Honey never spoils.",
    "Sharks existed before trees."
]

print("✨ Welcome to the Fun Fact Generator ✨")
while True:
    user_input = input("Press Enter for a fun fact or type 'exit': ").strip().lower()
    if user_input == "exit":
        print("Thanks for exploring fun facts with me! 🌸")
        break
    print(random.choice(fun_facts))
🧭 Sample Output
✨ Welcome to the Fun Fact Generator ✨
Press Enter for a fun fact or type 'exit':
🐝 Honey never spoils.

Press Enter for a fun fact or type 'exit':
🦈 Sharks existed before trees.
πŸ”— GitHub Repo
Check out the full code here πŸ‘‡
πŸ‘‰ Day-27 Fun Fact Generator

🧠 What I Learned
How simple ideas can be fun to build

Using randomness to make programs feel interactive

The joy of creating something others can enjoy too ✨
here is the link;
[https://github.com/shadowMomina/Day-27-Fun-Fact-Generator-.git](https://github.com/shadowMomina/Day-27-Fun-Fact-Generator-.git)

πŸ’¬ Your Turn!
If you could add ONE fun fact to this project, what would it be?
Drop it in the comments, and I might feature your fact in the next update 🐍
Enter fullscreen mode Exit fullscreen mode

Top comments (0)