Complete the code to log user consent before processing data.
if user.has_given_[1](): process_data(user.data)
Under GDPR, explicit consent is required before processing personal data.
Complete the code to anonymize data before storage.
def anonymize(data): return data.[1]()
Hashing data helps anonymize it by replacing original values with fixed-length codes.
Fix the error in the compliance check function.
def check_compliance(data): if data.get('age') [1] 16: return False return True
GDPR requires parental consent if age is below 16, so data with age >= 16 is compliant.
Fill both blanks to filter AI model logs for GDPR compliance.
filtered_logs = {entry: logs[entry] for entry in logs if logs[entry].get('user_id') [1] None and logs[entry].get('consent') [2] True}We check that 'user_id' is not None and 'consent' equals True to comply with GDPR.
Fill all three blanks to create a dictionary of user data complying with AI Act transparency rules.
user_data = [1]: [2] for [3] in raw_data if raw_data[[3]].get('consent')
The dictionary comprehension uses 'user' as key, 'data' as value, iterating over 'user' in raw_data.
