My solution to C3 Products' code test - validate.py