Intermedio
19 agosto 2026

Trova il bug: Data Science & ML

Uno snippet di codice. Trova il bug, o dimostra che non ce n'è.

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()

Clicca sulle righe che causano il problema.

Il tuo verdetto

Un tentativo al giorno. La risposta appare subito dopo.

Mantieni la tua serie

Crea un account per conservare la tua serie e seguire i tuoi progressi.

Crea un account