Last active
March 31, 2024 00:01
-
-
Save mcsee/b7eb7b4def657b3798dea3c0bdcf0809 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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