Drill

ProblemsPython › logistics

Is this address complete enough to ship

easylogisticsPython

The checkout refuses street-level addresses without a door number. A record has the street name and a number field that may be empty.

address_valid(street: string, door_number: int) → bool

Solve it in the editor →

Where you start

def address_valid(street: str, door_number: int) -> bool:
    

Worked examples

CallResult
address_valid("Bagdat Cad no 12", 12)True
address_valid(" ", 5)False
address_valid("Kumsal Sok", 0)False
address_valid("", 12)False

Hint

Trim the street, then check the number.

Reference solution in Python
def address_valid(street: str, door_number: int) -> bool:
    return bool(street.strip()) and door_number > 0

The same problem in another language

More logistics problems in Python