Skip to content

Commit

Permalink
Use codeblocks in quiz answers
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed Dec 23, 2024
1 parent dc98c37 commit 95a4e67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common-content/en/module/tools/head-and-tail/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Imagine we have an input file which has 100 lines.
{{<multiple-choice
delimiter="~"
question="What command/pipeline could we write to skip the first three lines of the file, and then output the next 2 lines?"
answers="head -n3 input | tail -n2 ~ tail -n+4 | head -n2 ~ tail -n+3 | head -n2"
answers="`head -n3 input | tail -n2` ~ `tail -n+4 | head -n2` ~ `tail -n+3 | head -n2`"
feedback="No - remember each stage in a pipeline applies to the output of the previous stage, not the original file. ~ Right - tail skips the first few lines, then head takes just a few from the top of that output. ~ Not quite - how many lines does this skip?"
correct="1" >}}
8 changes: 4 additions & 4 deletions common-content/en/module/tools/sort-and-uniq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ hamsters 300
{{<multiple-choice
delimiter="~"
question="What command would output the lines of the file sorted alphabetically?"
answers="sort input.txt ~ sort -u input.txt ~ sort input.txt | uniq"
feedback="Right - sort sorts the file. ~ Not quite - what does -u do? ~ Not quite - what does piping to uniq do?"
answers="`sort input.txt` ~ `sort -u input.txt` ~ `sort input.txt | uniq`"
feedback="Right - sort sorts the file. ~ Not quite - what does `-u` do? ~ Not quite - what does piping to uniq do?"
correct="0" >}}

{{<multiple-choice
delimiter="~"
question="What command would output the lines of the file sorted by the number after the first space, starting with hamsters 300?"
answers="sort -k1 input.txt ~ sort -k2 input.txt ~ sort -k2 -r -n input.txt ~ sort -k2 -n input.txt"
feedback="Not quite - check what -k1 does. ~ Not quite - look at the difference between alphabetical sorting and numerical sorting. ~ Right! We need to select the right field, sort numerically, and reverse the order to go biggest to smallest. ~ Close, but what order will things be sorted?"
answers="`sort -k1 input.txt` ~ `sort -k2 input.txt` ~ `sort -k2 -r -n input.txt` ~ `sort -k2 -n input.txt`"
feedback="Not quite - check what `-k1` does. ~ Not quite - look at the difference between alphabetical sorting and numerical sorting. ~ Right! We need to select the right field, sort numerically, and reverse the order to go biggest to smallest. ~ Close, but what order will things be sorted?"
correct="2" >}}

{{<multiple-choice
Expand Down
2 changes: 1 addition & 1 deletion common-content/en/module/tools/tr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Learn about `tr` from its man page (and the backlog exercises).
{{<multiple-choice
delimiter="~"
question="What command could we write to delete all of the vowels from the input?"
answers="tr -d 'aeiou' ~ tr 'aeiou' '' ~ tr -d '[aeiou]'"
answers="`tr -d 'aeiou'` ~ `tr 'aeiou' ''` ~ `tr -d '[aeiou]'`"
feedback="Right - we list all of the vowels as things to delete. ~ No - the no-flag form of tr doesn't allow an empty second string. ~ No - this will remove all of the vowels, but also remove other characters. tr doesn't accept regular expressions."
correct="0" >}}

0 comments on commit 95a4e67

Please sign in to comment.