You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"question": "Variable named <code>num_items_in_stock</code>",
30
+
"type": "multiple_choice",
31
+
"answers": [
32
+
{
33
+
"answer": "int",
34
+
"correct": true,
35
+
"feedback": "Correct. Stock counts are whole numbers (integers). Usually you would not track 3.5 items in stock."
36
+
},
37
+
{
38
+
"answer": "str",
39
+
"correct": false,
40
+
"feedback": "While you could store it as text, numbers allow mathematical operations like adding or subtracting stock."
41
+
},
42
+
{
43
+
"answer": "float",
44
+
"correct": false,
45
+
"feedback": "Stock counts usually are whole numbers, not decimals."
46
+
},
47
+
{
48
+
"answer": "bool",
49
+
"correct": false,
50
+
"feedback": "The name implies a quantity, not just yes or no."
51
+
}
52
+
]
53
+
},
54
+
{
55
+
"question": "Variable named <code>height_m</code>",
56
+
"type": "multiple_choice",
57
+
"answers": [
58
+
{
59
+
"answer": "float",
60
+
"correct": true,
61
+
"feedback": "Correct. Height measurements typically have decimal precision (like 1.75m). The '_m' suffix indicates the unit (meters). If you also have <code>height_ft</code> or <code>height_cm</code>, putting the unit in the variable name keeps them distinct."
62
+
},
63
+
{
64
+
"answer": "str",
65
+
"correct": false,
66
+
"feedback": "You need to perform calculations with height values, like comparisons or conversions."
67
+
},
68
+
{
69
+
"answer": "int",
70
+
"correct": false,
71
+
"feedback": "While technically possible if you only need whole meters, measurements typically require decimal precision. Float is the conventional choice for physical measurements."
72
+
},
73
+
{
74
+
"answer": "bool",
75
+
"correct": false,
76
+
"feedback": "This represents a measurement value, not yes or no."
77
+
}
78
+
]
79
+
},
80
+
{
81
+
"question": "Variable named <code>is_student</code>",
82
+
"type": "multiple_choice",
83
+
"answers": [
84
+
{
85
+
"answer": "bool",
86
+
"correct": true,
87
+
"feedback": "Correct. The 'is_' prefix is a Python convention for boolean values. Someone either is or isn't a student."
88
+
},
89
+
{
90
+
"answer": "str",
91
+
"correct": false,
92
+
"feedback": "While you could use 'yes' or 'no' strings, bool is the Pythonic choice for true or false values."
93
+
},
94
+
{
95
+
"answer": "int",
96
+
"correct": false,
97
+
"feedback": "Don't use 0 and 1 for true and false - use bool instead."
98
+
},
99
+
{
100
+
"answer": "float",
101
+
"correct": false,
102
+
"feedback": "This is a yes or no question, not a number."
103
+
}
104
+
]
105
+
},
106
+
{
107
+
"question": "Variable named <code>participants</code><br><br><em>This variable name is ambiguous. Select all types that could be reasonable interpretations, then discuss: how would you rename this variable to be clearer?</em>",
108
+
"type": "many_choice",
109
+
"answers": [
110
+
{
111
+
"answer": "int",
112
+
"correct": true,
113
+
"feedback": "Yes, this could work if you're counting the number of participants. Better name: <code>participant_count</code> or <code>num_participants</code>."
114
+
},
115
+
{
116
+
"answer": "str",
117
+
"correct": true,
118
+
"feedback": "Yes, this could work if it's a text description like 'students and teachers'. Better name would depend on what you're describing - perhaps <code>participant_description</code>."
119
+
},
120
+
{
121
+
"answer": "float",
122
+
"correct": false,
123
+
"feedback": "This is unlikely - you can't have fractional participants. The main issue is that the variable name doesn't clearly communicate its purpose."
124
+
},
125
+
{
126
+
"answer": "bool",
127
+
"correct": false,
128
+
"feedback": "This doesn't fit - the name doesn't follow the 'is_' or 'has_' pattern typically used for booleans (like <code>has_participants</code>)."
0 commit comments