generated from mwc/lab_pipes
I made new files for 100k words, 10k words, and 1k words, and answered
the questions in exercises.md. I think with this lab, it was harder to detect when the code I wrote was not what I wanted. With the drawings in unit 1, you can tell what is off because you see what the code creates, and you get an error message. With this, you can't easily see what is off because you are just seeing a very long list of words. For this lab, I feel like I had to "check my work" by printing some of the intermediate steps and making sure they made sense.
This commit is contained in:
parent
f3f7410cab
commit
f4de347539
30
exercises.md
30
exercises.md
|
@ -10,32 +10,42 @@ If you want to be really stylish, put your code inside of backticks like this:
|
|||
`cat words_100k.txt | length | put 10 | equal | count`
|
||||
|
||||
## 1. What is the longest word?
|
||||
|
||||
antidisestablishmentarianism, which is 28 characters long
|
||||
`cat words_100k.txt | length | order | tail`
|
||||
|
||||
## 2. How many words have two u's in a row?
|
||||
|
||||
16
|
||||
`cat words_100k.txt | match "uu" | count`
|
||||
|
||||
## 3. How many words have the word "cat" in them?
|
||||
|
||||
893
|
||||
`cat words_100k.txt | match "cat" | count`
|
||||
|
||||
## 4. How many words have all five vowels (aeiou)?
|
||||
|
||||
812
|
||||
`cat words_100k.txt | match "a" | match "e" | match "i" | match "o" | match "u"`
|
||||
|
||||
## 5. Which words have two e's in a row, two o's in a row, and two k's in a row? (they don't have to be in that order)
|
||||
|
||||
bookkeeper, bookkeepers, bookkeeping
|
||||
`cat words_100k.txt | match "ee" | match "oo" | match "kk"`
|
||||
|
||||
## 6. How many words have sixteen or more letters?
|
||||
|
||||
696
|
||||
`cat words_100k.txt | length | put 15 | lessthan 0 1 | count`
|
||||
|
||||
## 7. What's the most frequent 10-letter word?
|
||||
|
||||
government
|
||||
`cat words_100k.txt | frequency | order -r | pluck 1 | length | put 10 | equal | head`
|
||||
|
||||
## 8. What's the longest word which doesn't have any repeated letters?
|
||||
|
||||
copyrightable, salpingectomy, troublemaking, unpredictably, unproblematic - these all have thirteen unique letters
|
||||
`cat words_100k.txt | length | order | unique 1 | length | equal 0 2`
|
||||
|
||||
## 9. What's the longest word which only uses four different letters?
|
||||
|
||||
senselessness
|
||||
`cat words_100k.txt | length | order | unique 1 | length | put 4 | equal`
|
||||
|
||||
## 10. If you rearrange the letters in "sidebar," what other words can you create?
|
||||
|
||||
braised seabird
|
||||
`cat words_100k.txt | length | put 7 | equal |pluck 2 | match "s" | match "i" | match "d" | match "e" | match "b" | match "a" | match "r"`
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue