Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calculates weekly, biweekly, and monthly salary only for 2 states. AZ and NY
def calculations():
salary = int(input("What is your yearly salary?"))
state = input("What state are you in? Choose a number \n 1: AZ \n 2: NY\n:")
states = {'1': .83, '2': .73}
state_tax = states.get(state)
weekly = int((salary / 52) * state_tax)
monthly = int((salary / 12) * state_tax)
biweekly = weekly * 2
print("Weekly: $" + str(weekly) + "\nMonthly: $" + str(monthly) + "\nBiWeekly: $" + str(biweekly))
new_calculation = input("Would you like to calculate another salary? Y/N:")
if new_calculation == 'y' or new_calculation == 'Y':
restart()
else:
exit
def restart():
calculations()
calculations()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.