exercises.md

This commit is contained in:
njmason2
2025-10-01 03:24:03 -04:00
parent 5b36298dd9
commit c2bf4fdce4
7 changed files with 210047 additions and 22 deletions

View File

@@ -9,33 +9,36 @@ 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?
## 1. What is the longest word? antidisestablishmentarianism
# $ cat words_100k.txt | length | order | tail -n 1 | pluck 1
## 2. How many words have two u's in a row? 16
# $ cat words_100k.txt | match "uu" | count
## 2. How many words have two u's in a row?
## 3. How many words have the word "cat" in them?
## 4. How many words have all five vowels (aeiou)?
## 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" | 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 "ee" | match "oo" | match "kk"
## 6. How many words have sixteen or more letters? 696
# $ cat words_100k.txt | length | order | put 15 | lessthan 0 1 | count
## 6. How many words have sixteen or more letters?
## 7. What's the most frequent 10-letter word? government
# $ cat words_100k.txt | length | put 10 | equal 0 1 | pluck 2 | frequency | order -r | head -n 1 | pluck 1
## 8. What's the longest word which doesn't have any repeated letters? unproblematic
# $ cat words_100k.txt | length | unique 1 | length | equal 0 2 | pluck 3 | length | order -r | head -n 1 | pluck 1
## 7. What's the most frequent 10-letter word?
## 8. What's the longest word which doesn't have any repeated letters?
## 9. What's the longest word which only uses four different letters?
## 10. If you rearrange the letters in "sidebar," what other words can you create?
## 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 | pluck 4 | length | order -r | head -n 1 | pluck 1
## 10. If you rearrange (all) the letters in "sidebar," what other words can you create? braised seabird
# $ cat words_100k.txt | length | put 7 | equal 0 1 | pluck 2 | match "s" | match "i" | match "d" | match "e" | match "b" | match "a" | match "r"