Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a privacy setting to 'private'.
Intro to Computing
user_profile['privacy'] = '[1]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'public' exposes data to everyone.
✗ Incorrect
The privacy setting should be set to 'private' to restrict access.
2fill in blank
mediumComplete the code to check if data encryption is enabled.
Intro to Computing
if settings['encryption'] == [1]: print('Data is secure')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'disabled' will not secure the data.
✗ Incorrect
Encryption must be 'enabled' to ensure data security.
3fill in blank
hardFix the error in the code to properly delete user data.
Intro to Computing
if user_consent == [1]: delete_data(user_id)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'False' deletes data without consent.
✗ Incorrect
User data should only be deleted if consent is True.
4fill in blank
hardFill both blanks to filter data for users with consent and encrypt it.
Intro to Computing
filtered_data = {user: data for user, data in all_data.items() if data['consent'] == [1]
encrypted_data = encrypt([2]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Encrypting all data instead of filtered data.
✗ Incorrect
Filter users with consent True and encrypt the filtered data.
5fill in blank
hardFill both blanks to create a dictionary of users with encrypted emails who consented.
Intro to Computing
secure_users = {user: [1] for user, info in users.items() if info['consent'] == [2] } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of braces for dictionary.
✗ Incorrect
Use a dictionary comprehension with braces, encrypt emails, and filter by consent True.