GH avatar Bite 12. Write a user validation function

Create a function that takes a username and checks for a valid user:

  1. The username is in USERS,
  2. the user is not expired, and
  3. the user has the ADMIN role.

If those 3 conditions are met return SECRET.

If one of the conditions is not True raise an exception you define yourself: UserDoesNotExist, UserAccessExpired and UserNoPermission respectively. Check out the tests for more detail.

Have fun and keep calm and code in Python!

go back Intermediate level
Bitecoin 3X

138 out of 142 users completed this Bite.
Will you be Pythonista #139 to crack this Bite?
Resolution time: ~44 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.33 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Buy Now Login and get coding
We use Python 3.7