-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathassignment.typ
More file actions
160 lines (119 loc) · 3.65 KB
/
Copy pathassignment.typ
File metadata and controls
160 lines (119 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#import "@preview/exm:0.1.0": *
#show: doc => assignment(doc,
courseid: "CourseID",
coursename: "CourseName",
school: "School",
semester: "Semester",
assignment: "Assignment XX",
title: "Assignment Title"
)
#let section = section.with(number: true)
#docmode.update("screen")
#section("Question Components", number: true)[
A standard question:
#question(ansbox: true, height: 2cm, points: 4.0)[
What is $2 + 2$? Write a statement to evaluate in Python.
// since this is just Typst content, it can be anything (could include tables, math, images, code blocks, etc...)
][
```py
2 + 2 # 4
```
]
A multi-choice question:
#mcq([What will the following Python expression be equivalent to?
#align(center)[`2 + 2`]
], (
`4`,
`len(np.array([1, 2, 3, 4]))`,
`2`,
`6`,
"None of the above"
),
(0, 1),
points: 3.0,
multi: (true, true, true, true, false)
)
#mcq([You can display options with different column lengths.], (
[Option 1], [Option 2], [Option 3], [Option 4]
),
2,
points: 3.0,
multi: false,
cols: (2.5cm, 5cm, 7cm, 4cm),
)
An answer bank:
#ansbank(cols: 3, choices: (
[$x^2$], "A quadratic", `x ** 2`,
"A quartic", $x dot.c x dot.c x$, `pow(x, 3)`
))
#mcq([
What of the following functions are even?
],
range(8).map(i => [*#str.from-unicode(65 + i)*]) + ("None of the above",),
(0,3,4),
points: 1.0,
cols: range(8).map(i => 1.53cm) + (10cm,),
multi: range(8).map(i => true) + (false,)
)
#ansbank(cols: 3, choices: (
[$x^2$], "Any linear function", `x ** 2`,
"Any quadratic function", $x dot.c x dot.c x$, `pow(x, 3)`,
$sin(x)$, "Any quartic function", $cos(x)$
))
#mcq([
What of the following functions are even?
],
range(9).map(i => [*#str.from-unicode(65 + i)*]) + ("None of the above",),
(0,2,8),
points: 1.0,
cols: range(9).map(i => 1.53cm) + (10cm,),
multi: range(9).map(i => true) + (false,)
)
]
#pagebreak()
#section("Second Section", points: true)[
Content in this second section does total up points
+ #question(points:2.0)[Subquestion][Subquestion answer]
+ #question(points:2.0)[Subquestion][Subquestion answer]
+ #question(points:2.0)[Subquestion][Subquestion answer]
]
#pagebreak()
#section("Callouts")[
#callout("")[
You may create a callout with an empty string `""` to omit the title. Any non-special typed callout will be grey by default.
]
Special callout types (`Definition, Formula, Method, Example`)
#callout("Definition")[
A definition callout
]
#callout("Formula")[
A formula callout
]
#callout("Method")[
A method callout
]
#callout("Example")[
An example callout
]
]
#v(24pt)
#section("Code Blanks")[
Complete the `distance` function below, which takes arrays of two predictor variables `p1` and `p2` and returns a distance between a new point `row` and each row in the training data.
`def distance(p1, p2, row):`
` arr = np.array(row)`
` v1 = arr.`#blank(150pt, "[A]")
` v2 = arr.`#blank(150pt, "[B]")
` distances = `#blank(250pt, "[C]")
` `#blank(200pt, "[D]")
#v(4pt)
+ #question(points:2.0,ansbox:true,height:1.5cm)[
What function should be used in blanks `[A]` and `[B]` to retrieve the two items in the array?
][`.item`]
+ #question(points:2.0,ansbox:true,height:1.5cm)[
Fill in the blank `[C]`, such that the `distance` function returns an *array* of Euclidean distances.][
`((p1 - v1) ** 2 + (p2 - v2) ** 2) ** 0.5` #h(3pt) *or* #h(3pt) use `np.sqrt(...)`
]
+ #question(points:1.0,ansbox:true,height:1.5cm)[
Fill in the blank `[D]`.
][`return distances`]
]