Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

How can I create and compare lists from 2 words on scratch/snap? I'm trying to create a block that will take 2 words that are

How can I create and compare lists from 2 words on scratch/snap?

I'm trying to create a block that will take 2 words that are no longer than 4 letters and create 2 lists containing each of the characters in these words. The block will then report which characters from the 2 words are the same.

For example:

Word 1: ABCG List 1: A, B, C, G

Word 2: EBFG List 2: E, B, F, G

The bock will then report 2 and 4 because the 2nd and 4th values of words 1 and 2 are the same.

So far I have:

image text in transcribed

However, when I run this block it reports 0.

image text in transcribed

How do I fix this?

+ matching + characters + word1 + word2 + script variables word1 word2 list1 list24 set list1 to word list word1 set list to word list word2 for each item in list1 report keep items list1 = list2 from list2 + length: 1 matching characters ABCG EBFG + matching + characters + word1 + word2 + script variables word1 word2 list1 list24 set list1 to word list word1 set list to word list word2 for each item in list1 report keep items list1 = list2 from list2 + length: 1 matching characters ABCG EBFG

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions