Have you ever wanted to create funny, political, celebrity, or animal news headlines automatically? π°
In this post, Iβll share a simple Python project that generates random news headlines. It's beginner-friendly and a fun way to practice Python programming.
What is this project about?
The Random News Headline Generator is a Python terminal-based project that generates random headlines across four categories:
- Funny News π
- Political News ποΈ
- Celebrity News π
- Animal News πΎ
Itβs perfect for beginners who want to:
- Practice Python basics
- Learn random data generation
- Work with lists and loops
- Create small but fun projects
Features
- Generates random headlines in different categories
- Simple terminal interface
- Easy to expand with your own categories
- Can be improved with file saving, GUI, or web interface
How it works
The project uses Python lists to store headlines and the random module to pick one randomly.
Hereβs a simplified example:
import random
funny_news = [
"Man Tries to Pay With Banana, Cashier Confused",
"Cat Becomes Mayor of Small Town"
]
political_news = [
"Election Results Shock Everyone",
"Politician Forgets Speech on Stage"
]
category = input("Choose category (funny/political): ").lower()
if category == "funny":
print(random.choice(funny_news))
elif category == "political":
print(random.choice(political_news))
else:
print("Category not found!")
You can expand the lists and categories as much as you want. But For real fun you should check my code at Github....Link is at end of post.
How to Run the Project
Make sure you have Python 3.x installed
Download or clone the repository:
git clone https://github.com/bilal-dev-0x/random-news-headline-generator.git
cd random-news-headline-generator
Run the project:
python main.py
Follow the on-screen instructions to generate random headlines π
Why this project is useful
- Even though itβs a small project, it helps you:
- Practice Python loops and lists
- Understand random module usage
- Learn how to structure a small project
- Build something fun and shareable
Itβs a great starting point before moving on to GUI apps or web projects.
Next Steps / Improvements
- Add more categories (Sports, Tech, etc.)
- Add file export to save generated headlines
- Convert it into a GUI app using Tkinter
- Share it as a web app using Flask or Streamlit
Final Thoughts
This Random News Headline Generator is a fun beginner project that you can finish in a few hours.
Itβs a good addition to your portfolio because it shows you can:
- Work with Python basics
- Build small projects
- Think about user interaction
Check out the GitHub repo here:
Random News Headline Generator
Connect with me on LinkedIn:
Bilal Aslam
Top comments (0)