Skip to content

Instantly share code, notes, and snippets.

@emarte91
Last active October 8, 2018 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emarte91/64d86d964490f9a08e17af4581cb6f6c to your computer and use it in GitHub Desktop.
Save emarte91/64d86d964490f9a08e17af4581cb6f6c to your computer and use it in GitHub Desktop.
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