## Discuss Scratch

polargiant3
New to Scratch
2 posts

### Coding Word Problem in Script

I'm working on a lesson plan called “Interactive Word Problem Posters” from Makey Makey. The coding is partially done in the script but how do I know if the answer is right or wrong? Please see the link to my script below.

https://scratch.mit.edu/projects/199305873/#editor

Thank you!
Michelle Thomas
DaEpikDude
Scratcher
1000+ posts

### Coding Word Problem in Script

Well, there are a few problems with your script that you can change:
1: To divide something by something, you can't just type “12/4” in the box.
`<[12/4] =[3]>`
would check if “12/4” is the same as “3”, which it isn't. You need to use the divided by block, i.e.
`<((12) / (4)) = [3]>`
Also, that would just check if 12 / 4 = 3 which would always return true. To use the ask block, you also use the block “answer” which is right next to the ask block.
So your code would look like:
`if <(answer) = [3]> then...end`
I also noticed that you can optimise your code: since it checks if the answer is correct, then constantly repeats if it's not, you can do this instead:
`ask [question so and so] and waitrepeat until <(answer) = [the answer]> // if it's right in the first place this will never happenask [That's not right, try again] and waitendsay [you did it yay congrendulates]`

Also, for future reference, when you have a problem with code you might want to put your topic in the Help with Scripts forum. I'll report this thread to be moved for you

I haven't changed my signature in a while now so here's some pi tau as a placeholder thing
6.2831853071 7958647692 5286766559 0057683943 3879875021 1641949889 1846156328 1257241799 7256069650 6842341359 6429617302 6564613294 1876892191 0116446345 0718816256 9622349005 6820540387 7042211119 2892458979 0986076392 8857621951 3318668922 5695129646 7573566330 5424038182 9129713384 6920697220 9086532964 2678721452 0498282547 4491740132 1263117634 9763041841 9256585081 8343072873 5785180720 0226610610 9764093304 2768293903 8830232188 6611454073 1519183906 1843722347 6386522358 6210237096 1489247599 2549913470 3771505449 7824558763 6602389825 9667346724 8813132861 7204278989 2790449474 3814043597 2188740554 1078434352 5863535047 6934963693 5338810264 0011362542 9052712165 5571542685 5155792183 4727435744 2936881802 4499068602 9309917074 2101584559 3785178470 8403991222 4258043921 7280688363 1962725954 9542619921 0374144226 9999999674 5956099902 1194634656 3219263719 0048918910 6938166052 8504461650 6689370070 5238623763 4202000627 5677505773 1750664167 6284123435 5338294607 1965069808 5751093746 2319125727 7647075751 8750391556 3715561064 3424536132 2600385575 3222391818 4328403978 7619051440 2130971726 5577318723 0676365593 6460603904 0706037059 3799154724 5198827782 4994435505 6695826303
1149714484 9083013919 0165906623 3723455711 7781501967 6350927492 9878638510 1208018554 0334227801 9697648025 7167232071 2741532020 9420363885 9111923978 9353567489 8896510759 5494536942 0809506929 2416093368 5181389825 8662735405 7978304209 5043241139 3204811607 6300387022 5067648600 7117528049 4992946527 8283985452 0853984559 3564709563 2720186834 4328243984 9172630060 5723659491 1141349967 7010989177 1738539913 8185442159 5018605910 6423306899 7440551192 0472961330 9982397636 6959550713 2739614853 0850557251 0363683514 9345781955 5455876001 6329412003 2290498384 3464344295 4470028288 3947137096
polargiant3
New to Scratch
2 posts

### Coding Word Problem in Script

Hello,
How do you make the program repeat until the student gets the problem right?
https://scratch.mit.edu/projects/199305873/#editor
Thank You!
Michelle Thomas
DaEpikDude
Scratcher
1000+ posts

### Coding Word Problem in Script

Right now your program isn't actually using the student's answer, it's just checking if 12 / 4 is 3, which of course it is.
To fix this just replace the “12 / 4” block with the answer block (which is right next to ask and wait).

I haven't changed my signature in a while now so here's some pi tau as a placeholder thing
6.2831853071 7958647692 5286766559 0057683943 3879875021 1641949889 1846156328 1257241799 7256069650 6842341359 6429617302 6564613294 1876892191 0116446345 0718816256 9622349005 6820540387 7042211119 2892458979 0986076392 8857621951 3318668922 5695129646 7573566330 5424038182 9129713384 6920697220 9086532964 2678721452 0498282547 4491740132 1263117634 9763041841 9256585081 8343072873 5785180720 0226610610 9764093304 2768293903 8830232188 6611454073 1519183906 1843722347 6386522358 6210237096 1489247599 2549913470 3771505449 7824558763 6602389825 9667346724 8813132861 7204278989 2790449474 3814043597 2188740554 1078434352 5863535047 6934963693 5338810264 0011362542 9052712165 5571542685 5155792183 4727435744 2936881802 4499068602 9309917074 2101584559 3785178470 8403991222 4258043921 7280688363 1962725954 9542619921 0374144226 9999999674 5956099902 1194634656 3219263719 0048918910 6938166052 8504461650 6689370070 5238623763 4202000627 5677505773 1750664167 6284123435 5338294607 1965069808 5751093746 2319125727 7647075751 8750391556 3715561064 3424536132 2600385575 3222391818 4328403978 7619051440 2130971726 5577318723 0676365593 6460603904 0706037059 3799154724 5198827782 4994435505 6695826303
1149714484 9083013919 0165906623 3723455711 7781501967 6350927492 9878638510 1208018554 0334227801 9697648025 7167232071 2741532020 9420363885 9111923978 9353567489 8896510759 5494536942 0809506929 2416093368 5181389825 8662735405 7978304209 5043241139 3204811607 6300387022 5067648600 7117528049 4992946527 8283985452 0853984559 3564709563 2720186834 4328243984 9172630060 5723659491 1141349967 7010989177 1738539913 8185442159 5018605910 6423306899 7440551192 0472961330 9982397636 6959550713 2739614853 0850557251 0363683514 9345781955 5455876001 6329412003 2290498384 3464344295 4470028288 3947137096
omega_red
Scratcher
6 posts

### Coding Word Problem in Script

Saying ‘repeat until 12/4=3’ is the same as saying ‘repeat until 1=1’, which will always be true, no matter what the answer. maybe try this :
`repeat until <(answer) = [3]>ask [whats 12/3?] and waitend`

Last edited by omega_red (Feb. 9, 2018 08:51:24)

asivi
Scratcher
1000+ posts

### Coding Word Problem in Script

omega_red wrote:

Saying ‘repeat until 12/4=3’ is the same as saying ‘repeat until 1=1’, which will always be true, no matter what the answer. maybe try this :
`repeat until <(answer) = [3]>ask [whats 12/3?] and waitend`

4?