generated from mwc/lab_pipes
completed the exercise and questions
This lab requires a little more critical thinking skills than lab 1. I've done exercises like this before in a database setting. I think I had a difficult time with the rearranging letters question because I needeed to go back to see how I can write it concisely. The longer my pipes got, the more likely I was to making mistakes. I did ask my group mates for help and the discord chat. I am getting more comfortable with that.
This commit is contained in:
35
exercises.md
35
exercises.md
@@ -10,32 +10,45 @@ If you want to be really stylish, put your code inside of backticks like this:
|
|||||||
`cat words_100k.txt | length | put 10 | equal | count`
|
`cat words_100k.txt | length | put 10 | equal | count`
|
||||||
|
|
||||||
## 1. What is the longest word?
|
## 1. What is the longest word?
|
||||||
|
`cat words_100k.txt | length | order | tail -n 1`
|
||||||
|
28 antidisestablishmentarianism
|
||||||
|
|
||||||
## 2. How many words have two u's in a row?
|
## 2. How many words have two u's in a row?
|
||||||
|
`antidisestablishmentarianism`
|
||||||
|
16
|
||||||
|
|
||||||
## 3. How many words have the word "cat" in them?
|
## 3. How many words have the word "cat" in them?
|
||||||
|
`cat words_100k.txt | match "cat" | count`
|
||||||
|
893
|
||||||
|
|
||||||
## 4. How many words have all five vowels (aeiou)?
|
## 4. How many words have all five vowels (aeiou)?
|
||||||
|
`cat words_100k.txt | match "^(?=.*a)(?=.*e)(?=.*i)(?=.*o)(?=.*u).*" | count`
|
||||||
|
812
|
||||||
|
|
||||||
## 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)
|
## 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)
|
||||||
|
`cat words_100k.txt | match "^(?=.*ee)(?=.*oo)(?=.*kk).*"`
|
||||||
|
bookkeeper
|
||||||
|
bookkeepers
|
||||||
|
bookkeeping
|
||||||
|
|
||||||
## 6. How many words have sixteen or more letters?
|
## 6. How many words have sixteen or more letters?
|
||||||
|
`cat words_100k.txt | length | put 16 | lessthan 0 1| count`
|
||||||
|
342
|
||||||
|
|
||||||
## 7. What's the most frequent 10-letter word?
|
## 7. What's the most frequent 10-letter word?
|
||||||
|
`cat words_100k.txt | frequency | length 1 | put 10| equal 0 1 | order 2| tail -n 1`
|
||||||
|
10 10 372000 government
|
||||||
|
|
||||||
## 8. What's the longest word which doesn't have any repeated letters?
|
## 8. What's the longest word which doesn't have any repeated letters?
|
||||||
|
`cat words_100k.txt | unique| length 1 | length 1| equal | order | tail -n 1`
|
||||||
|
salpingectomy
|
||||||
|
|
||||||
## 9. What's the longest word which only uses four different letters?
|
## 9. What's the longest word which only uses four different letters?
|
||||||
|
`cat words_100k.txt | unique| length 0 | put 4 | equal | pluck 3 | length | order | tail -n 1`
|
||||||
|
13 senselessness
|
||||||
|
|
||||||
## 10. If you rearrange the letters in "sidebar," what other words can you create?
|
## 10. If you rearrange the letters in "sidebar," what other words can you create?
|
||||||
|
`cat words_100k.txt | match "^(?=[abdeirs]{7}$)(?=.*a)(?=.*b)(?=.*d)(?=.*e)(?=.*i)(?=.*r)(?=.*s)"`
|
||||||
|
braised
|
||||||
|
seabird
|
||||||
|
sidebar
|
||||||
|
|||||||
100000
words_100k.txt
Normal file
100000
words_100k.txt
Normal file
File diff suppressed because it is too large
Load Diff
10000
words_10k.txt
Normal file
10000
words_10k.txt
Normal file
File diff suppressed because it is too large
Load Diff
1000
words_1k.txt
Normal file
1000
words_1k.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user