def sign_up():
    userid = input('Enter UserID : ')
    query = 'select * from login;'
    try:
        cursor.execute(query)
        fetch = cursor.fetchall()
        n = len(fetch)
        flag = 0
        for i in range(n):
            if (userid == fetch[i][0]):
                print('User already exist!, redirecting to login page')
                flag = 1
                login()
        if (flag == 0):
            pswd = input('Enter password : ')
            re_pswd = input('Enter password again : ')
            if (pswd == re_pswd):
                query = (((("insert into login values('" + userid) + "', '") + pswd) + "');")
                try:
                    cursor.execute(query)
                    print('Sign up successful')
                except:
                    db.rollback()
                    print('Sign up fail')
            else:
                print("Password didn't match")
    except:
        db.rollback()
def sign_up():
    userid = input('Enter UserID : ')
    query = 'select * from login;'
    try:
        cursor.execute(query)
        fetch = cursor.fetchall()
        n = len(fetch)
        flag = 0
        for i in range(n):
            if (userid == fetch[i][0]):
                print('User already exist!, redirecting to login page')
                flag = 1
                login()
        if (flag == 0):
            pswd = input('Enter password : ')
            re_pswd = input('Enter password again : ')
            if (pswd == re_pswd):
                query = (((("insert into login values('" + userid) + "', '") + pswd) + "');")
                try:
                    cursor.execute(query)
                    print('Sign up successful')
                except:
                    db.rollback()
                    print('Sign up fail')
            else:
                print("Password didn't match")
    except:
        db.rollback()