Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active March 31, 2024 00:01
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 mcsee/b7eb7b4def657b3798dea3c0bdcf0809 to your computer and use it in GitHub Desktop.
Save mcsee/b7eb7b4def657b3798dea3c0bdcf0809 to your computer and use it in GitHub Desktop.
VALID_COLUMNS = ['name', 'gender', 'email']
def process_API_information(data):
invalid_columns = [
column for column in data.keys() if column not in VALID_COLUMNS
]
if invalid_columns:
raise ValueError(
f"Invalid columns detected: {', '.join(invalid_columns)}"
) # Shows WHICH columns are invalid
data = {'name': 'John', 'gender': 'Pangender',
'age': 47, 'email': 'john@example.com'}
process_API_information(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment