DEV Community

Cover image for VAT Calculator Online
Beembuilds
Beembuilds

Posted on

VAT Calculator Online

This is a VAT calculator that I made in Python3. It has the ability to add or remove VAT (20%) to any numerical value provided. The result then automatically copies to clipboard so that the value can be used where required. It is programmed to loop so that it can be used with as many values as needed.

VAT calculator

This is the code I used.
import pyperclip

vat = 1.2

def remove_vat(x, y):
return x / y
def add_vat(x , y):
return x * y

while True:
print("#### VAT Calculator ####")
num = float(input("Enter Amount: "))

print("Choose Operation:")
print("1. Remove VAT")
print("2. Add VAT")

choice = input("Enter Choice(1/2):")
result = 0

if choice =='1':
    result = remove_vat(num , vat)
elif choice == '2':
    result = add_vat(vat , num)
else:
    print("Invalid Input")

print(round(result , 2))
pyperclip.copy(round(result , 2))
Enter fullscreen mode Exit fullscreen mode

I was inspired to make this because I was using an online VAT calculator which was effective but I believed that I could speed up my workflow by making this simple tool and did not want to rely on an internet connection to be able to use it.

Top comments (0)