Looking to land a data science role? Practice interviewing with a few questions per week.

```
import pandas as pd
import numpy as np
```

define function

```
#Return the post-tax earnings of an individual,
#assuming varying tax brackets depending on annual wage
def calcEarnings(hours, wage):
earnings = hours*wage
if earnings >= 2000:
#30% tax rate for weekly earnings above $2000
earnings = earnings*.70
else:
#15% tax rate for weekly earnings below $2000
earnings = earnings*.85
return earnings
#return the raw earnings of an individual (assuming no varying rates for overtime)
def calcEarnings_pretax(hours, wage):
earnings = hours*wage
return earnings
def main():
hours = float(input('Enter hours worked for the week: '))
wage = float(input('Enter dollars paid per hour: '))
total = calcEarnings(hours, wage)
total_pre_tax = calcEarnings_pretax(hours, wage)
taxes = total_pre_tax - total
print('Pre-tax earnings for {hours} hours at ${wage:.2f} per hour are ${total_pre_tax:.2f}.'
.format(**locals()))
print('Post-tax earnings for {hours} hours at ${wage:.2f} per hour are ${total:.2f}.'
.format(**locals()))
print('You gave uncle sam ${taxes:.2f} this week!'
.format(**locals()))
main()
```

Enter hours worked for the week: 40

Enter dollars paid per hour: 55

Pre-tax earnings for 40.0 hours at $55.00 per hour are $2200.00.

Post-tax earnings for 40.0 hours at $55.00 per hour are $1540.00.

You gave uncle sam $660.00 this week!