Help with Acronym block, any tips or guidance appreciated

What's problem you are encountering?
Want to create an Acronym block that takes in
“The Beauty and Joy of Computing” and
Outputs: BJC

This is the exercise, from OpenSAP From Media Computation to Data Science:

Your current version of the acronym function doesn’t properly work for some names like “The Beauty and Joy of Computing”. You want to leave out the “The”, the “and”, and the “of”, but you will also lose the “J” in “Joy” because its length is less than four letters. Try to come up with ideas to get to this result: BJC

What have you tried that didn't work?
Tried using the identical block and tried using a For Each block

Screen Shot 2021-09-08 at 5.37.35 PM

Post a project example, link, or screenshot:

Here's a hint: Try using UNICODE OF.

The question is asking you what criterion you can use instead of "at least four letters," such that "Beauty" "Joy" and "Computing" all make the cut. What property do those three words have in common, not shared by "the" "and" and "of"?

Ah, Capital Letters!

:~)

??? T he Beauty and Joy of Computing is shortened to BJC not TBJC :wink:

Oh interesting. Maybe a hybrid approach is needed?

I remember that one library in BYOB has a block like this too. It simply rules out all the "of and the a an to..." words. so maybe:
script var result
for each item in split sentence by word {
if not [of, and, the, a, an, to, and other words like that] includes item
join result, first letter of item
}
report result

Tried to do a list inside a list, but is not working as I think it'd work... no items are deleted from list "my words"

https://snap.berkeley.edu/project?user=test19230&project=OpenSap%20-%20Media%20-%20w3%20-%20Unit%202%3A%20Exercises%201.1

Try this:

When you use FOR EACH, the variable ITEM contains the actual item, not the item's position in the list. So you can't use it as input to the DELETE command, which needs the position.

Thanks @warped_wart_wars, @bh !

If you need the position of an item in the for each block, you can use this block (in list library)
image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.