Question: Create a when [ space ] key _ pressed script to implement your algorithm. Depending on your algorithm and the way in which you choose

Create a when[space]key_pressed script to implement your algorithm. Depending on your algorithm and the way in which you choose to implement it, you may also decide to have a when_green_flag_clicked script. This question focuses on Part3(selection) and Part4(repetition). As inspiration for this question, you might like to revisit Activity4.8 of Part4, which uses a list of specific characters.
The teacher wishes to see if her pupils can make sense of words in which certain letters have been replaced.
She requires a when[space]key_pressed script that will take a word from the user and display a new word that is the same as the original except that each letter from the second half of the alphabet has been replaced by a # symbol. For clarification, the second half of the alphabet should be considered as: n, o, p, q, r, s, t, u, v, w, x, y and z.
The user should input the word as a single string and the new word that is displayed should be a single string.
For example, if the user enters
range
then
#a#ge
is displayed.
One way to create the new word to be displayed is to start with the new word as an empty string and then work through the letters in the original word from first to last, creating the new word incrementally. If the current letter is not in the second half of the alphabet, then we add it to the new word, otherwise we add the symbol # to the new word. This might be visualised as in Figure2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!