def add_rec():
    '''Add data to db from user input (L1)'''
    # get current date
    currDate = time.strftime("%d-%m-%Y", time.localtime(time.time()))
    cont = 1

    os.system("cls")

    #print function header
    print "ADD Record"
    print "=========="
    print "(Key in '-e' to back to main menu)"
    
    while cont == 1:
        print "\nKey in new record .. "
        # get input for date
        date = raw_input("Date : ")
        back_main_menu(date)

        if date == "":
            date = currDate
        else:
            while date_check(date) == 0:
                print "Error! It's not a date.\n"
                date = raw_input("Date : ")
                back_main_menu(date)
                if date == "":
                    date = currDate
                
        # get input for description
        desc = raw_input("For : ")
        back_main_menu(desc)

        # get input for amount
        amt = raw_input("Total : RM ")
        back_main_menu(amt)

        while amt_check(amt) == 0:
            print "Error! It's not a money.\n"
            amt = raw_input("Total : RM")
            back_main_menu(amt)
        amt = "%.2f" % float(amt)

        # insert to sqlite
        add_func(date, desc, amt)

        resp = raw_input("Continue ? ")
        resp = resp.upper()
        if resp == 'N':
            cont = 0
    # return to main menu
    main_menu()
Add data to db from user input (L1)
recipes/Python/496762_Personal_Finance_Assistance/recipe-496762.py