diff --git a/Info.json b/Info.json new file mode 100644 index 0000000..b496058 --- /dev/null +++ b/Info.json @@ -0,0 +1 @@ +{"username": "srijan", "password": "123", "phone": "1212121"}{"username": "ram", "password": "222", "phone": "12121212"}{"username": "james", "password": "1111", "phone": "12121212121"}{"username": "hari", "password": "12345", "phone": "12121212"} \ No newline at end of file diff --git a/srijan-assignment2.py b/srijan-assignment2.py new file mode 100644 index 0000000..caadd14 --- /dev/null +++ b/srijan-assignment2.py @@ -0,0 +1,47 @@ +import json +user_data=[] +while True: + print("SIGNUP/SIGNIN") + CHOOSE=int(input("signup(1) or signin(2)")) + + + if CHOOSE==1: + username=str(input("enter your username: ")) + password=input("enter your password: ") + phone=input("enter your phone number: ") + user_data = {"username": username, "password": password, "phone": phone} + + print("signup successful") + + with open('Info.json', 'a') as f: + json.dump(user_data,f) + + + elif CHOOSE==2: + + username=str(input("enter your username: ")) + password=input("enter your password: ") + with open('Info.json', 'r') as f: + data1=json.load(f) + print(data1) + if username in user_data and user_data[username]['password'] == password: + print("Welcome USER") + else: + print("Incorrect username or password.") + + + + + + + + + + + + + + + + + \ No newline at end of file