- Fork and clone this repository.
- Familiarize yourself with the file structure of this repository.
- Achieve the following objectives by carefully reading what is being asked and executing.
You are given a file named users.txt. Your goal is to validate that each user's username is unique.
Create a function called validate_file() (in name_checker.py) which accepts a name of a file to validate. This function validates the users.txt file and checks that the first name for each user does not contain any numbers (0123456789). This function raises (throws) a ValidationException object and is consumed in the following manner:
Test Case:
def test():
try:
validate_file("users.txt")
except ValidationException as ve:
print(ve)
test()Output:
Invalid first name: 'B1ll'
- This tests your ability to read files, select the correct data, manipulate strings and use Exceptions in python.
GLHF :)