Login and get codingComplete the
validate_license
function writing a regular expression that matches a PyBites license key which:
- Starts with PB,
- following 4 times dash (-) and 8 chars which can be upper case chars or digits,
- for example: PB-U8N435EH-PG65PW87-IXPWQG5T-898XSZI4 would be a valid license key.
Return a
bool
(we added some type hinting for convenience).Example how this function would work:
>>> import re >>> from license import validate_license >>> validate_license('PB-U8N435EH-PG65PW87-IXPWQG5T-898XSZI4') True >>> validate_license('pb-U8N435EH-PG65PW87-IXPWQG5T-898XSZI4') False >>> validate_license('bogus') False >>> validate_license('PB-U8N435EH-PG65PW87-IXPWQG5T-898XSZ..') FalseHave fun and code more Python!
367 out of 372 users completed this Bite.
Will you be the 368th person to crack this Bite?
Resolution time: ~30 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.27 on a 1-10 difficulty scale.
» Up for a challenge? 💪