Menu
Coddy logo textTech

Exception Handling Exercise- 1

Lesson 13 of 16 in Coddy's Exception Handling in Python course.

Solve below challenge:-

The signed password for user "coddy" is "12345". Create a function which will take password as input from user. If entered password doesn't matches with stored password, then raise Invalid_Password Exception with message "Invalid password, try again". Else, print "session created". User will be prompted again and this continues until user enters correct password. Check test cases and expected output before writing program.

challenge icon

Challenge

Easy

Solve above problem

Try it yourself

stored_password = "12345" #fetched from database (Imagine)

def login():
    try:
        password = input()
    #your code goes here
    

All lessons in Exception Handling in Python