Thursday, February 2, 2023

When to use Old Tax Regime

I have written a python script to calculate when to use old tax regime compare to new tax regime, below table conveys:

If your salary is 8L and if your exemption is more than 1.6L then choose old tax regime, if your salary is more than 15L and if your exemption is more than 3.75L choose old tax regime

Exemption does not include standard deduction since standard deduction is common to both, so it is deducted in both the incomes

Script can calculate upto 50L salary, to make it simple it does not contain surcharges !! 



import math
oldRegimeIncomeTaxSlabs = [[0, 2.5], [5, 2.5], [20, 5], [30, math.inf]]
newRegimeIncomeTaxSlabs = [[0, 3], [5, 3], [10, 3], [15, 3], [20, 3],[30, math.inf]]
standard_ded = 50000
#nps = 0
def taxCalculation(totalSalary, regime, totalExemption):
if regime == 'old':
regimeSlabs = oldRegimeIncomeTaxSlabs
else:
regimeSlabs = newRegimeIncomeTaxSlabs
totalExemption = 0
taxableIncome = totalSalary - totalExemption -standard_ded
tax = 0
index = 0
taxableIncomeAux = taxableIncome
while(index < len(regimeSlabs) and taxableIncomeAux > 0):
if taxableIncomeAux >= regimeSlabs[index][1] * 100000:
tax = tax + regimeSlabs[index][1] * 100000 * regimeSlabs[index][0] * 0.01
else:
tax = tax + taxableIncomeAux * \
regimeSlabs[index][0] * 0.01
taxableIncomeAux = taxableIncomeAux - regimeSlabs[index][1] * 100000
index += 1
return tax

income_min = 800000
income_max = 2500000
exemption_min = 0
exemption_max = 500000
income_temp = income_min
exemption_temp = 0
x = 0
income_exempt = {}
while income_temp < income_max:
exemption_temp = 0
newTax = taxCalculation(income_temp, 'new', 0)
while exemption_temp < exemption_max and exemption_temp < income_temp:
exemption_temp += 5000
oldTax = taxCalculation(income_temp, 'old', exemption_temp)
print(income_temp, exemption_temp, newTax, oldTax)
if(oldTax <= newTax):
if income_temp not in income_exempt:
income_exempt[income_temp] = exemption_temp
income_temp += 100000

print(income_exempt)
for key, value in income_exempt.items():
print(key, value)



Monday, April 27, 2020

Docker

This is for MAC users.

Get the docker from the below website

https://hub.docker.com/editions/community/docker-ce-desktop-mac/

After downloading and place it in application folder

then check

jitsunda@JITSUNDA-M-C3T1 ~ % docker --version        
Docker version 19.03.8, build afacb8b
jitsunda@JITSUNDA-M-C3T1 ~ % 


Wednesday, July 4, 2018

Form 26 AS View [for my reference]

In order to file an income tax, we need to have Form 26 AS

For the past two weeks whenever I click, I have been re-directing to nri services !! :(

(I am connected to (vpn) in my laptop and the browser assumes that the client is from outside India) !!

once I disconnect vpn, it lands up in proper TDS website instead of asking for nri registration




Thanks and Regards
Jith

Wednesday, January 3, 2018

First python script

Open an editor with first.py

type below lines

print("hi")

print("jith")

Now run it in terminal,

JITSUNDA-M-C2XF:~ jitsunda$ python3 first.py
hi
jith

JITSUNDA-M-C2XF:~ jitsunda$ 

Python interactive mode - REPL

Read–Eval–Print Loop (REPL) is an interactive language shell or interactive computer programming environment. The advantage of having REPL is that the environment receives input from user, evaluates and results in an interactive manner. No need for scripting.


JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> 

I use python3, 

Simply type python3, we will get ">>>" prompt, we can write simple instructions and get the results as shown below



JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hi")
hi
>>> 4+3
7
>>> x = "jith"
>>> x
'jith'

>>> 

Intro to Python

Introduction to Python

Python is a computer language similar to C, C++, Java, C# etc .. However there are lot of features in python make it unique compare to other languages. Especially, the unprecedented growth of data science and machine learning is making Python as most popular language at present. This is due to the flexibility and computational friendly nature of Python.

Advantages of Python

Very high level language, so we can prototype rapidly an idea or an algorithm
Object oriented programming, Interpreted, Interactive and Portable
It can interact with C and C++ well (Extensibility feature of Python)
Large set of packages
Easy integration
Apt for scientific computing
Dynamically typed

Limitations of Python

In my opinion, Still it is considered as glue language or just scripting language or language for automating tasks in industry rather than being used as a main-stream language such as Java, C#, C etc ..
Slow compare to C






Sunday, October 11, 2015

pthread

#include "stdio.h"
#include "stdlib.h"
#include "pthread.h"

void thread_run(int m){

    int i = 0;
    while( i < 100 ){
        printf("I am in thread %d\t %d\n", m, i);
        i++;
    }

}

int main()
{
int i;
pthread_t tid;

    for(i = 0; i < 5; i++){
   pthread_create(&tid, NULL, thread_run, i);
    }

pthread_exit(NULL);
return 0;
}

 gcc -lpthread -o pt examp_1.c