Kodewick
Start learning →
Basic←→0 / 80

Check the pickup code

#028BasicStringsConditions4 min

Parcel lockers use a 6-digit pickup code, and people often type extra spaces in the middle or at the ends. Write valid_pickup(code): remove every space, then return True if exactly 6 digits are left, otherwise False. An empty string is False too.

Examples
valid_pickup("123456")→True
valid_pickup("123 456")→True
main.py
def valid_pickup(code):
    digits = code
    # your code here: remove every space from digits
    # your code here: return True if it's 6 long and all digits
    return False
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.