Password Manager

Company: Hp_3march

Difficulty: easy

Problem Statement

Password Manager Sakra is writing her own password manager. The third-party one she used before could not tell her which passwords an account had already used, so her version keeps a history : every password ever accepted stays in a list, and the last item of that list is the current password . Model her design as a class Password_manager . Data member old_password — a list of strings holding all of the user's past passwords. Its last item is the current password. Constructor __init__(self) — starts old_password empty. Methods get_password(self) — returns the current password, i.e. the most recently accepted one, or None when no password has been set yet. set_password(self, password) — appends password to old_password only if it differs from every password already in the history. A duplicate does nothing. An empty string is not a valid password and is never added. The method returns nothing. is_correct(self, password) — returns True when password equals the current password, False othe