Validate if string matches UUID format.
Create a utility function is_uuid(text) that checks whether a given string is a valid UUID (Universally Unique Identifier).
A UUID is a 128-bit value, usually represented as a 36-character string in the form:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Where each x is a hexadecimal digit (0–9, a–f).
It may also accept uppercase hex letters (A–F).
Examples:
print(is_uuid("550e8400-e29b-41d4-a716-446655440000")) -> True
print(is_uuid("123e4567-e89b-12d3-a456-42661417400")) -> False (too short)
Instructions:
- Create the function in validators.py
- See and follow the used pattern
- Write test cases.
- Please do update the documentation too, github link: documentation link
Validate if string matches UUID format.
Create a utility function is_uuid(text) that checks whether a given string is a valid UUID (Universally Unique Identifier).
A UUID is a 128-bit value, usually represented as a 36-character string in the form:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Where each x is a hexadecimal digit (0–9, a–f).
It may also accept uppercase hex letters (A–F).
Examples:
print(is_uuid("550e8400-e29b-41d4-a716-446655440000")) -> True
print(is_uuid("123e4567-e89b-12d3-a456-42661417400")) -> False (too short)
Instructions: