Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Hi can someone please help me with this question?
- gwarbear
-
New Scratcher
2 posts
Hi can someone please help me with this question?
Hi I've tried countless combinations for this question and getting nowhere. If someone could point me in the right direction it would be really helpful cheers.
————————————————————————————
The teacher wishes to see if her pupils can make sense of words in which each consonant (that is, non-vowel) has been replaced by the character @. (For the purposes of this question vowels are the letters a, e, i, o, u.)
She requires a whenkey_pressed script that will take a word from the user and display a new word that is the same as the original except that every consonant is replaced by @.
The user should input the word as a single string and the new word that is displayed should be a single string.
So for example if the user enters
'rhinocerous'
then
'@@i@o@e@ou@'
is displayed.
—————————————————————————
My code is below:
Your text to link here…
I am relatively new to scratch and have since seen some wonderful programs on here so this is a super basic question for some, but I cannot get it to work the way i want and pulling my hair out at same time!
Any help would be a great help thanks.
————————————————————————————
The teacher wishes to see if her pupils can make sense of words in which each consonant (that is, non-vowel) has been replaced by the character @. (For the purposes of this question vowels are the letters a, e, i, o, u.)
She requires a whenkey_pressed script that will take a word from the user and display a new word that is the same as the original except that every consonant is replaced by @.
The user should input the word as a single string and the new word that is displayed should be a single string.
So for example if the user enters
'rhinocerous'
then
'@@i@o@e@ou@'
is displayed.
—————————————————————————
My code is below:
Your text to link here…
I am relatively new to scratch and have since seen some wonderful programs on here so this is a super basic question for some, but I cannot get it to work the way i want and pulling my hair out at same time!
Any help would be a great help thanks.
- MasterofTheBrick
-
Scratcher
1000+ posts
Hi can someone please help me with this question?
Your code isn't wrong and you are going in the right direction, the only problem is that some of your variables are misplaced and that the join block inputs are flipped. Below is the fixed version of your script so far.
when [space v] key pressed
ask (...) ::sensing
set [word v] to (answer)
set [new word v] to () //this should be a blank, not a space
set [position v] to (1)
repeat (length of (word))
if <not <[VOWELS v] contains (letter (position) of (word)) ?>> then
set [new word v] to (join (new word) (letter (position) of (word))
else
set [new word v] to (join (new word) [@])
end
change [position v] by (1)
end
say (new word) for (2) secs
Last edited by MasterofTheBrick (July 17, 2021 15:05:54)
- EpicGhoul993
-
Scratcher
1000+ posts
Hi can someone please help me with this question?
Seriously?! Why do you guys keep asking this question? Is this a homework place or something?
- RL1123
-
Scratcher
1000+ posts
Hi can someone please help me with this question?
Here's what I did: thttps://scratch.mit.edu/projects/552965299/editor
Also, you probably shouldn't ask about your homework in help with scripts.
Also, you probably shouldn't ask about your homework in help with scripts.
- Yusei-Fudo
-
Scratcher
1000+ posts
Hi can someone please help me with this question?
Make a new custom block like this:

Then program the custom block like this:

After that, do this and you're done:

Note that this will replace a space with “@.” To change that, or can just do this:
Instead of “Not whitelist contains letter letter # of text”, you can take that condition and put it into an or operator like this:

Then program the custom block like this:

After that, do this and you're done:

Note that this will replace a space with “@.” To change that, or can just do this:
Instead of “Not whitelist contains letter letter # of text”, you can take that condition and put it into an or operator like this:
<<not<(whitelist)contains(letter (letter #) of (text))?>> or <(letter(letter #)of(text))=["space"]>>//the contains block is an operator, I just don't know how to make it green.
Last edited by Yusei-Fudo (July 17, 2021 19:46:45)
- gwarbear
-
New Scratcher
2 posts
Hi can someone please help me with this question?
Hi thanks guys for the advice. You have really helped me out thanks!!
- suripsa-tutor
-
Scratcher
8 posts
Hi can someone please help me with this question?
Seriously?! Why do you guys keep asking this question? Is this a homework place or something?Why do you care
- MasterofTheBrick
-
Scratcher
1000+ posts
Hi can someone please help me with this question?
Reported to be closed as resolved.
- Discussion Forums
- » Help with Scripts
-
» Hi can someone please help me with this question?
