How can I make something happen if [variable] is divisible by [number]?

How can I make something happen if a variable is divisible by a certain number? For example, if my coins are divisible by ten, I will get a bomb that blows up the entire planet. In my multiplication repl, a "hard question" will appear for every certain amount of questions. I think I need some help for knowing how to implement this. I'm pretty sure it's something like:
"Questions = AnswersRight + AnswersWrong"
and then
"if (Questions % 10) == 0:"
[whatever else I'm going to add]

You are viewing a single comment. View All

This is simple, just use normal if and modulo operator (%). The modulo operator basically divides your two numbers, then return the remainder.

Since you are using an if chain, use else if (or just elif) to continue the chain.

Also, I want to point out that in the while loop, you imported random twice, which is unnecessary, just import it once on the first line of the file.