Skip to content

Add Palindrome project #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions Palindrome/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
![Star Badge](https://img.shields.io/github/stars/ndleah/python-mini-project?style=social)
![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)

# Palindrome Checker

## 🛠️ Description

This open-source project contains a strict palindrome checker built using Python's `tkinter` module. The checker evaluates user input and determines if it is a **strict palindrome**, meaning it is **case-sensitive**, **space-sensitive**, and **punctuation-sensitive**.

If you want, you can get the Python files and edit them as you want. Feel free to contribute to this repository. You can:
1. Improve functionality
2. Fix a bug
3. Or add a new cool feature

Try to contribute as much as you can. Even a small contribution is enough.

## ⚙️ Languages or Frameworks Used

- Python
- Tkinter (built-in module – no installation required)

No external libraries are needed. This project runs on standard Python 3.x installations.

## 🌟 How to run

You can type this command on your terminal to run the script:

```bash
python Palindrome/palindrome.py
````

If this doesn't work, try:

```bash
python3 Palindrome/palindrome.py
```

To stop it you can press `CTRL + C`.

## 📺 Demo

**1️⃣ Input is *not* a palindrome due to whitespace sensitivity (e.g., `"A man a plan a canal Panama"`):**

![Non-Palindrome](screenshot1.png)

**2️⃣ Input *is* a strict palindrome (e.g., `"madam"`):**

![Strict Palindrome](screenshot2.png)

## 🤖 Author

This script is by AshnaParveen.

GitHub: [AshnaParveen](https://github.com/AshnaParveen)


24 changes: 24 additions & 0 deletions Palindrome/palindrome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import tkinter as tk
from tkinter import messagebox

def check_palindrome():
text = entry.get()
if text == text[::-1]:
messagebox.showinfo("Result", "It's a palindrome!")
else:
messagebox.showinfo("Result", "Not a palindrome.")

# GUI Setup
root = tk.Tk()
root.title("Palindrome Checker")

label = tk.Label(root, text="Enter a string:")
label.pack(pady=5)

entry = tk.Entry(root, width=30)
entry.pack(pady=5)

check_btn = tk.Button(root, text="Check", command=check_palindrome)
check_btn.pack(pady=10)

root.mainloop()
Binary file added Palindrome/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Palindrome/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.