generated from mwc/lab_pipes
In this assignment I fixed pipeline commands to correctly filter, count, and organize words while fixing errors that I might come across.
I thought this lab was really cool. From Unit 1 it felt different because I was working with using commands such as cat and using the straight line which was totally different from before. The codes from Unit 1 compared to Unit 2 look completely different and more intimadating. In terms of learning, this kind of thinking felt fimiliar becuase I took computing courses that lookk familiar. The way I used terminal felt so different compared to Unit 1 because for Unit 1 it seemed to be more straight torward whereas so far in Unit 2 it has all these other commands seperated with the '|' symbol. Working on this lab made me realize how cool it was to use code to find specific words with specific requirments rather than looking one at a time. I got stuck on the last 3 problems of the exercise and what I did to get unstuck is I messaged one of the students and asked for help. I have just now started getting help from my peers because I have some in my in-person classes so it makes it easier to comunication about the lessons.
This commit is contained in:
30
exercises.md
30
exercises.md
@@ -11,31 +11,61 @@ If you want to be really stylish, put your code inside of backticks like this:
|
||||
|
||||
## 1. What is the longest word?
|
||||
|
||||
`cat words_100k.txt | length | order -r | head -n 1`
|
||||
|
||||
The longest word is antidisestablishmentarianism
|
||||
|
||||
## 2. How many words have two u's in a row?
|
||||
|
||||
`cat words_100k.txt | match "uu" | count`
|
||||
|
||||
16 words have two u's in a row
|
||||
|
||||
## 3. How many words have the word "cat" in them?
|
||||
|
||||
cat words_100k.txt | match "cat" | count
|
||||
|
||||
`893 words have the word "cat" in them`
|
||||
|
||||
## 4. How many words have all five vowels (aeiou)?
|
||||
|
||||
`cat words_100k.txt | match "a" | match "e" | match "i" | match "o" | match "u" | count`
|
||||
|
||||
812 words have all five vowels
|
||||
|
||||
## 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" | match "oo" | match "kk"`
|
||||
|
||||
bookkeeper, bookkeepers, and bookkeeping
|
||||
|
||||
## 6. How many words have sixteen or more letters?
|
||||
|
||||
`cat words_100k.txt | length | put 16 | lessthan -e | count`
|
||||
696 words have sixteen or more letters
|
||||
|
||||
## 7. What's the most frequent 10-letter word?
|
||||
|
||||
`cat words_100k.txt | length | put 10 | equal | pluck 2 | frequency | order -r | head -n 1`
|
||||
|
||||
The most frequent 10-letter word is government
|
||||
|
||||
## 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?
|
||||
|
||||
`cat words_100k.txt | unique | length 0 | put 4 | equal | pluck 3 | length | order | tail -n 1`
|
||||
|
||||
senselessness
|
||||
|
||||
## 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
|
||||
Reference in New Issue
Block a user