#/usr/bin/env Python3
#coding: Utf-8
Import OS
Import Sys
Import Getpass
Import JSON
Storage_user_file = "./username.py"
Correct_user = "KK"
Correct_pass = "KK"
For I in range (3):
Existing_users_dict = json.load (open (Storage_user_file, ' R '))
Get_user = input ("Please your username")
Get_pass = input ("Please your password")
if Correct_user = = Get_user and Correct_pass = = Get_pass:
Print ("Welcome to login..")
Break
Else
If Get_user in Existing_users_dict:
If Existing_users_dict[get_user] >= 3:
Print ("You are locked")
Break
Else
Existing_users_dict[get_user]+=1
Json.dump (Existing_users_dict,open (Storage_user_file, "w"))
Print ("The user name or password entered is incorrect.")
Else
Existing_users_dict[get_user] = 1
Json.dump (Existing_users_dict,open (Storage_user_file, "w"))
Print ("The user name or password entered is incorrect.")
Python Learning Day1 Landing