Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » RE; Doing maths quiz
- suspus121
- New to Scratch
14 posts
RE; Doing maths quiz
hi there
How do I show right answer to a question. I have random generator to number ..
Given Percentage x Whole number = Answer
If Answer = Answer
than
Broadcast right
Else
Broadcast Wrong
this is where I need help.. How do I broadcast or show right answer
How do I show right answer to a question. I have random generator to number ..
Given Percentage x Whole number = Answer
If Answer = Answer
than
Broadcast right
Else
Broadcast Wrong
this is where I need help.. How do I broadcast or show right answer
- gor-dee
- Scratcher
1000+ posts
RE; Doing maths quiz
You should store the Given percentage, the whole number and the correct answer in variables. You could use the “say” block to display like this
say (join (join (join (join (join [correct, ] (Given percentage)) [% of]) (whole number)) [ = ]) (correct answer))
[/scratchblocks]
Last edited by gor-dee (Jan. 21, 2019 13:54:06)
- suspus121
- New to Scratch
14 posts
RE; Doing maths quiz
How do i store the variables..do I say correct answer = answer
- gor-dee
- Scratcher
1000+ posts
RE; Doing maths quiz
I'm thinking
set [ given percentage to v] to [75] //let's say 75%
set [whole number v] to (pick random (10) to (100))
set [correct answer v] to (((given percentage) / (100)) * (whole number))
ask (join (join (join [What is ] (given percentage)) [% of]) (whole number)) and wait
Last edited by gor-dee (Jan. 21, 2019 14:42:33)
- suspus121
- New to Scratch
14 posts
RE; Doing maths quiz
your a legend ..Im trying to understand basis of scrath ..Thanks for your help
I'm thinkingset [ given percentage to v] to [75] //let's say 75%
set [whole number v] to (pick random (10) to (100))
set [correct answer v] to (((given percentage) / (100)) * (whole number))
ask (join (join (join [What is ] (given percentage)) [% of]) (whole number)) and wait
- itzleo111
- Scratcher
31 posts
RE; Doing maths quiz
hi there
How do I show right answer to a question. I have random generator to number ..
Given Percentage x Whole number = Answer
If Answer = Answer
than
Broadcast right
Else
Broadcast Wrong
this is where I need help.. How do I broadcast or show right answer
when green flag clicked
set [whole num v] to (pick random (1) to (100)) //This will pick the whole number
set [percentage v] to (pick random (1) to (80)) //This will pick the percentage
set [result v] to (((percentage) / (100)) * (whole num)) //This will calculate the result
ask (join [What is ] (join (percentage) (join [% of ] (whole num)))) and wait
if <(answer) = (result)> then //This checks for correct answers
think [Correct!] for (2) secs
else
think [Wrong...] for (2) secs
end
Last edited by itzleo111 (Jan. 1, 2022 20:06:52)
- Discussion Forums
- » Help with Scripts
- » RE; Doing maths quiz