Lab 4.5 - It's Around Here Somewhere
Save your project as Lab 4.5
In this lab, you will implement several custom blocks performing variants of sequential search.
Part 1: You there
Write your own version of the contains block, which takes a list and a value as arguments. Then reports true if the value is in the list and reports false otherwise. You should NOT use the existing contains block in your implementation.
Part 2: Where
Write a custom block called index of that takes a list and a value as arguments and reports the index of the value found in the list. If the value is not in the list, report -1.
So, for example, if the list is (2, 3, 5, 7, 11) and the value is 5, "index of" should report 3.
If the list is (2, 3, 5, 7, 11) and the value is 4, "index of" should report -1.
Part 3: Tell Me More
Write a custom block called first e-word that takes a list as an argument and reports the first word in the list that starts with the letter 'e'. If no such word exists, report a blank (nothing).
Bonus: Write a custom block called first word that starts with that takes a list and a letter as arguments, and reports the first word in the list that starts with the given letter. If no such word exists, report a blank (nothing).
Grading rubric
1.1 contains block
1
2.1 index of block
1
3.1 first e-word block
2
Bonus: first word that starts with block
1
Total
5
Last updated
Was this helpful?