Creating sentences with lists

hi!! I'm trying to make a program that will create a sentence based on the words provided by a user for a class assignment. I am required to use lists and it has been going well until I was required to check if the users input includes only letters and not numbers or symbols. I'm new to snap so I'm not very familiar with many of the functions. i used the (is [ ] a "text") to check if the users input includes numbers only works for decimals, negative numbers, and numbers. However, if one inputs a letter and a number like "the62", the program will not detect an error. I tried splitting the users input and checking each character individually. But, I am not sure how to display the words to the user without all the letters being mashed together. At this point i am not sure what i am doing. The assignment is due tomorrow and i'm not sure if theres any easier way to do this. what should i do?

Splitting the text using untitled script pic 197 does make sense. After having sifted out (?) any numbers, you may want to recompose the text using untitled script pic 198.

The “input list” thing is crucial. Hover the character list over the right edge of the JOIN block and release when a red semi-transparent square appears.

Is this helpful?

BTW welcome to the forum!

Thank you so much for the quick reply!
I will try this right now! I'll let you know how it goes. Thank you again.

If i use the join input list for the code, the words that are provided by the user are still mashed together. For example, if the user inputs "hey6" and then "hello432", the original input is stored in a list (list 1). After being sifted through, the letters in both inputs are stored in another list (list 2). So, list 2 would have "h", "e", "y", "h", "e", "l", "l", "o" in it. When i display list 2 to the user, it just comes up as "heyhello" but i would like it to come up as "hey hello" . Am i doing something wrong? I would include an image of my code but it is not allowing me to.

that's how the block is supposed to work. you might be able to use MAP before you JOIN each item of the list

thank you! i will try that out.

You might be able to add a space after each word.

i'll try that! thank you

IMO you should load the "words and sentences" library, in which there's a block "join words" that will take a list of words and put spaces between them to make an output string.

And, you don't want to split the whole thing by letter; you want to split each word separately. So
MAP ((KEEP ((...)) ( )) (SPLIT (input) BY WORDS)
The "( )" in the KEEP will be filled by one word at a time. The "((...))" represents the code you're going to write!

It sounded like the user was inputting each word separately.

So? It's still best to do any processing when you have them all, no?

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