Files
lab_pipes/exercises.md
jwberent be2bd708c0 I answered the questions in the exercises.md file.
- This lab was different than unit 1 in that the turtle was not used.  Also, it used pipes which is something I have never seen before.  This lab was definitely much harder than anything we did in unit 1.
- This lab made me frustrated at times as I was not able to answer every question.  I think I got the majority of them correct though.  I have never done anythng similar to this before.
2025-09-26 14:22:10 -04:00

59 lines
1.8 KiB
Markdown

# 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?
antidisestablishmentarianism
cat words_100k.txt |length|order
## 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)?
8
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)
0
cat words_100k.txt |match "ee.*oo.*kk"|count
## 6. How many words have sixteen or more letters?
342
cat words_100k.txt | length|put 16|lessthan 0|count
## 7. What's the most frequent 10-letter word?
I couldn't figure it out.
I tried cat words_100k.txt |length|frequency | put 10|equal 0 2
## 8. What's the longest word which doesn't have any repeated letters?
unpredictably, copyrightable, unproblematic, troublemaking, salpingectomy are tied
cat words_100k.txt | length | unique 1 | length | equal 0 2|order|pluck 3
## 9. What's the longest word which only uses four different letters?
senselessness
cat words_100k.txt | length | unique 1 | length|put 4|equal 0 1|order 3|pluck 4
## 10. If you rearrange the letters in "sidebar," what other words can you create?
I couldn't figure this out. I tried using match and it didn't work.