Skip to content

Instantly share code, notes, and snippets.

@Gordin
Created December 5, 2022 14:07
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 Gordin/7deb6a8ec907c7b57306ef5520c37702 to your computer and use it in GitHub Desktop.
Save Gordin/7deb6a8ec907c7b57306ef5520c37702 to your computer and use it in GitHub Desktop.
When you ask ChatGPT to write a python function to estimate a persons net income, based on the most important social and economic factors
def estimate_net_income(gender: str, race: str, age: int,
education: str, occupation: str,
location: str, experience: int,
sexual_orientation: str,
disability_status: bool,
is_trans: bool,
family_status: str) -> float:
# Set base income to $40,000
income = 40000
# Adjust income based on gender
if gender.lower() == "male":
income *= 1.1
elif gender.lower() == "female":
income *= 0.9
else:
# Use the average adjustment for other genders
income *= 1.0
# Adjust income based on race
if race.lower() == "white":
income *= 1.05
elif race.lower() == "black":
income *= 0.95
elif race.lower() == "asian":
income *= 1.02
elif race.lower() == "latinx":
income *= 0.98
# Adjust income based on age
if age < 25:
income *= 0.8
elif age > 65:
income *= 0.6
# Adjust income based on education level
if education.lower() == "high school":
income *= 0.9
elif education.lower() == "bachelor's":
income *= 1.1
elif education.lower() == "master's":
income *= 1.3
elif education.lower() == "doctorate":
income *= 1.5
# Adjust income based on occupation
if occupation.lower() in ["tech", "healthcare", "finance"]:
income *= 1.2
elif occupation.lower() in ["retail", "food service", "manufacturing"]:
income *= 0.8
# Adjust income based on location
if location.lower() in ["new york", "san francisco", "boston"]:
income *= 1.1
elif location.lower() in ["kansas city", "birmingham", "omaha"]:
income *= 0.9
# Adjust income based on experience
income += 500 * experience
# Adjust income based on sexual orientation
if sexual_orientation.lower() in ["gay", "lesbian", "bisexual"]:
income *= 0.95
# Adjust income based on disability status
if disability_status:
income *= 0.8
# Adjust income based on trans status
if is_trans:
income *= 0.7
# Adjust income based on family status
if family_status.lower() == "single":
income *= 1.0
elif family_status.lower() == "married":
income *= 0.9
elif family_status.lower() == "single parent":
income *= 0.8
return income
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment