0

So, I just tried to code a tax calculator in which the user inputs the price and a country. I tried to make the program check for the tax rate of that particular country and then calculate the total price including the tax. But, just for few countries. Now, I'm struggling with this loop issue and I'm not sure how to get it fixed

country_and_taxes = {'INDIA':10,'US':12,'UK':20,'GERMANY':14,'AUSTRALIA':19,'JAPAN':5}

def value_for_keys(my_dict,country):

    tax_for_country = my_dict[country]

def tax_value(price,tax):
    total_with_tax = float(price) * (1 + float(tax)/100)
    print(f'The total price including a tax of {tax}% is ${total_with_tax}')

print('Tax Calcuator')
print('Here is a list of countries and their tax rates(in %): ')

for item in country_and_taxes.items():
    print(item)

calc_on = True

I'm not able to break out of this while loop even if I give a valid input

while calc_on:

    country = input('Enter your country (India, US, UK, Germany, Australia, Japan): ')

    if country.upper() != 'INDIA' or 'US' or 'UK' or 'GERMANY' or 'AUSTRALIA' or 'JAPAN':
        print("Please enter the country your looking for!")

    else:
        calc_on = False
    
price = int(input('Enter the price: '))
tax_rate = country_and_taxes[country.upper()]
tax_value(price,tax_rate)

print("Thanks for using our tax calculator!")

If there is something you know please let me know.

jeez
  • 1
  • 1

0 Answers0