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)