Computer Science
Grade 6
20 min
Personal Information
Personal Information
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Define Personally Identifiable Information (PII) and provide examples.
Group related personal information into a single data structure, like a dictionary or object.
Access specific pieces of personal information from a data structure using a key.
Validate the data type of a variable containing personal information (e.g., checking if age is a number).
Combine multiple variables of personal information into a single, formatted string for output.
Explain why it's important to handle personal information carefully in a program.
Have you ever filled out a form online to create a new account? 🤔 Where does all that personal information go and how does the computer understand it?
In this lesson, we'll explore advanced ways to handle personal informati...
2
Key Concepts & Vocabulary
TermDefinitionExample
Personally Identifiable Information (PII)Any information that can be used to figure out who a specific person is. It's super important to protect this data.Your full name, home address, email address, or phone number.
Data StructureA way of organizing and storing related data together in a single variable. A dictionary or object is a common type.A 'user' data structure could hold a name, age, and city all in one place, like: user = {'name': 'Alex', 'age': 12}
Key-Value PairThe way data is stored in a dictionary. The 'key' is the label (like 'name'), and the 'value' is the data itself (like 'Alex').In {'age': 12}, 'age' is the key and 12 is the value.
Data Validati...
3
Core Syntax & Patterns
Creating a Data Structure (Dictionary)
variable_name = { 'key1': value1, 'key2': value2 }
Use curly braces {} to create a dictionary. Inside, list key-value pairs. Keys are usually strings in quotes, followed by a colon, then the value. Separate each pair with a comma.
Accessing Data from a Structure
variable_name['key']
To get a value out of a dictionary, use the dictionary's variable name followed by square brackets [] containing the key (in quotes).
Basic Data Type Check
if is_number(variable): ...
Use a conditional statement (like 'if') with a function that checks the data type to make sure a variable contains the kind of data you expect before you use it.
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
An algorithm designed to recommend 'fun activities' is trained on data mostly from users in sunny places. It constantly recommends beach trips. If this app is used by someone in a snowy region, what problem, caused by the data, will they likely face?
A.The app will work perfectly and recommend skiing.
B.The app is showing algorithmic bias, leading to irrelevant suggestions.
C.The app will crash because it doesn't recognize snow.
D.The app will steal the user's location data.
Challenging
A simple calculator app on your phone asks for permission to access your contacts list and your real-time location. From a data privacy perspective, what is the main issue with this request?
A.The app needs this data to perform calculations correctly.
B.The app is likely collecting more personal information than it needs for its function.
C.This is standard for all apps and is not a concern.
D.The app will drain the battery by accessing this data.
Challenging
You are designing a chat program and want to create a rule to warn users before they send a number that might be a phone number. Which of the following is the BEST (though not perfect) rule to detect a potential US phone number?
A.IF message contains a string of 10 digits in a row THEN send warning
B.IF message contains any number THEN send warning
C.IF message contains the letter 'p' THEN send warning
D.IF message is longer than 10 characters THEN send warning
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free