This thinking was definitly different than previous labs because I had to think in layers. For last unit, you also have to think in layers but it was in a different way. The layers in this lab was crucial in making sure it is playing around with the words in the doc in the correct order. I really enjoyed this lab. It was more of a puzzle that would give me an answer right away. If i was doing it wrong, I could clearly see that and sometimes all it took was reordering my pipes to make it work correctly. I didn't have any ideas but I do wonder what bigger projects I could use manipulation with the terminal for. I did get stuck on a couple of questions. Even though each question was progressively harder than the previous one, I did skip a question If i was stuck on it for too long. Going ahead to something harder and working on it oddly helped me with the "easier" question before it. I did speak to my group a bit today about the project but not really the labs. All of us are kind of on different paces with the labs and we also meet the day after the previous lab is "due" so we don't really get to problem solve together, but more so just reflect.
2.0 KiB
Exercises
Answer the following questions (or at least as many as you can figure out) in this document. For all the questions, use the 100k words. Give your answer for each exercise, and show the command you used to get it. Each question can be answered using a single Terminal command, though you might need to use a number of pipes.
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?
28 antidisestablishmentarianism
cat words_100k.txt | length | order -r| head
2. How many words have two u's in a row?
16 words
cat words_100k.txt | match "uu" | count
3. How many words have the word "cat" in them?
893 words
cat words_100k.txt | match "cat" | count
4. How many words have all five vowels (aeiou)?
8 words
cat words_100k.txt | match "a.*e.*i.*o.*u" | count
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 "oo" | match "kk" | match "ee"
I accidently deleted question 6 but I think it was how many words have at least 16 letters?
696 words
cat words_100k.txt | length | order -r | put 16 | lessthan -e | count
7. What's the most frequent 10-letter word?
government
cat words_100k.txt | length | put 10 | equal | pluck 2 | frequency | order | tail -n 1
8. What's the longest word which doesn't have any repeated letters?
13 letters? unpredictably, copyrightable, unproblematic,troublemaking, salpingectomy
cat words_100k.txt | length | unique 1 | length | equal 0 2 | order
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 0 1 | tail
10. If you rearrange the letters in "sidebar," what other words can you create?
I cant figure this one out! I tried different variations of cat words_100k.txt | match "sidebar.*" and it wont work 😔