0
0
Intro to Computingfundamentals~10 mins

Tables, rows, and columns concept in Intro to Computing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a table with 3 columns.

Intro to Computing
table = [['Name', 'Age', [1]], ['Alice', 30, 'Engineer'], ['Bob', 25, 'Designer']]
Drag options to blanks, or click blank then click option'
AOccupation
BSalary
CCountry
DCity
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a column name that doesn't match the data in the rows.
Using a column name unrelated to the example data.
2fill in blank
medium

Complete the code to access the age of the second person in the table.

Intro to Computing
age = table[[1]][1]
Drag options to blanks, or click blank then click option'
A0
B1
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 which accesses the header row instead of data.
Using 2 which accesses the third person who does not exist.
3fill in blank
hard

Fix the error in the code to print the job of the first person.

Intro to Computing
print(table[1][[1]])
Drag options to blanks, or click blank then click option'
A2
B1
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 3 which is out of range.
Using index 1 which is the age, not the job.
4fill in blank
hard

Fill both blanks to create a new row and add it to the table.

Intro to Computing
new_row = ['Charlie', [1], [2]]
table.append(new_row)
Drag options to blanks, or click blank then click option'
A28
B'Teacher'
C'Doctor'
D35
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of age and occupation.
Using a string for age or a number for occupation.
5fill in blank
hard

Fill all three blanks to create a dictionary from the table row with keys as columns.

Intro to Computing
row_dict = {table[0][[1]]: table[1][[2]], table[0][[3]]: table[1][2]}
Drag options to blanks, or click blank then click option'
A0
B1
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing row and column indexes.
Using the same index for both keys and values incorrectly.