[Tutor] x%2

Noah Hall enalicho at gmail.com
Tue Jan 10 19:47:31 CET 2012


On Tue, Jan 10, 2012 at 6:24 PM, emin <oldcowboyrocky at gmail.com> wrote:
> answers = ["yes","no"]
> reaction = ["OK.I GOT IT.But why symbol of percent % not symbol of division
> / ?","PLEASE EXPLAIN MORE"]
>
> print "1st SORRY FOR BAD ENGLISH & DISTURBING:((i am beginner)"
> print "So you want to say it doesnt mean 2 percent of x and it means x
> divisible by 2?"
> print "Yes"
> print "or"
> print "No"
> answerChoise = raw_input("Type here: ")
>
> if answerChoise == "yes" or answerChoise == "Yes":
>   print reaction[0]
>
> elif answerChoise == "no" or answerChoise == "No":
>   print reaction[1]

Urm, yeah, while this is cute and all, it's not a great way of asking
a question.

I'm not totally sure what you mean, so I'm just going to say -

a / b is the division operator. It divides things. It returns a divided by b.
a % b is the remainder operator. It returns what's "left" after dividing a by b.


More information about the Tutor mailing list