DEV Community

Cover image for I Built a Simple Python App… But There’s a Hidden Bug Can You Spot It?
Tahami AK SERVICES
Tahami AK SERVICES

Posted on

I Built a Simple Python App… But There’s a Hidden Bug Can You Spot It?

✍️ Post Content

Bismillah

I’ve been practicing Python and decided to build a very simple login system.
Everything looks fine… but there’s a small bug...Read More

Can you find it?

🧩 The Code
def login(username, password):
if username == "admin" and password == 1234:
print("Login successful")
return True
else:
print("Invalid credentials")

User input

user = input("Enter username: ")
pwd = input("Enter password: ")

login(user, pwd)

🤔 The Problem

Even when I enter the correct password, it...Read More

💬 Your Challenge

Can you spot the bug?
Why is the condition failing?
How would you fix it?

Drop your answer below 👇

🤝 My Goal

I’m trying to improve my debugging skills...Read More

Let’s learn together 🚀

Top comments (0)