Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to log user consent before processing data.
MLOps
if user.has_given_[1](): process_data(user.data)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'approval' or 'permission' which are not the exact GDPR term.
✗ Incorrect
Under GDPR, explicit consent is required before processing personal data.
2fill in blank
mediumComplete the code to anonymize data before storage.
MLOps
def anonymize(data): return data.[1]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'encrypt' which can be reversed, not anonymized.
✗ Incorrect
Hashing data helps anonymize it by replacing original values with fixed-length codes.
3fill in blank
hardFix the error in the compliance check function.
MLOps
def check_compliance(data): if data.get('age') [1] 16: return False return True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which rejects compliant users.
✗ Incorrect
GDPR requires parental consent if age is below 16, so data with age >= 16 is compliant.
4fill in blank
hardFill both blanks to filter AI model logs for GDPR compliance.
MLOps
filtered_logs = {entry: logs[entry] for entry in logs if logs[entry].get('user_id') [1] None and logs[entry].get('consent') [2] True} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'is' instead of 'is not' for None check.
✗ Incorrect
We check that 'user_id' is not None and 'consent' equals True to comply with GDPR.
5fill in blank
hardFill all three blanks to create a dictionary of user data complying with AI Act transparency rules.
MLOps
user_data = [1]: [2] for [3] in raw_data if raw_data[[3]].get('consent')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names causing syntax errors.
✗ Incorrect
The dictionary comprehension uses 'user' as key, 'data' as value, iterating over 'user' in raw_data.