Mid-Level
August 19, 2026Spot the bug: Data Science & ML
One snippet. Find the bug, or prove there isn't one.
python
1import hashlib
2from sqlalchemy.orm import Session
3from models import User
4
5def register_user(db: Session, email: str, password: str) -> User:
6 hashed = hashlib.md5(password.encode()).hexdigest()
7 user = User(email=email, password_hash=hashed)
8 db.add(user)
9 db.commit()
10 db.refresh(user)
11 return user
12
13def verify_password(db: Session, email: str, password: str) -> bool:
14 user = db.query(User).filter_by(email=email).first()
15 if not user:
16 return False
17 return user.password_hash == hashlib.md5(password.encode()).hexdigest()Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.