[Tutor] x%2

Joel Goldstick joel.goldstick at gmail.com
Tue Jan 10 20:22:59 CET 2012


On Tue, Jan 10, 2012 at 1:47 PM, Noah Hall <enalicho at gmail.com> wrote:
> 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.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



-- 

The / operator signifies division.  The % signifies modulo.  see this:
http://en.wikipedia.org/wiki/Modulo_operation

and see this: http://docs.python.org/reference/expressions.html#index-998
Joel Goldstick


More information about the Tutor mailing list