python 2.4

how do I say... if x is divisible by (random number) then: in python coding?!? Thanks!!!

if (x % n) == 0 :

if (x % n) == 0 :

but what does the zero stand for in that????

Shouldn't it just be if x % n then???? Help me out it didn't work :-((

The % operator is used to return the remainder if one number were to be divided by another. So 5 % 2 would return 1, because 2 goes into 5 twice, with 1 left over. Another example is 10 % 2 which would return 2. 4 goes in twice, with 2 left over.
So x % n == 0 just means that there is no remainder (it fits perfectly).
Hope that helped!

why don't you upgrade to 2.5? I'm curious if there is special feature or just you love it!

why don't you upgrade to 2.5? I'm curious if there is special feature or just you love it!

Sorry, I don't understand you. What are you trying to say about Python 2.5? It's what I use, even though Python 2.6 is out now (or the early releases for 3.0).

Sorry, I don't understand you. What are you trying to say about Python 2.5? It's what I use, even though Python 2.6 is out now (or the early releases for 3.0).

I believe his question was in regards to the OP.

He was asking why he is still using 2.4 instead of 2.5 or later. And then he asked if he stuck with 2.4 because of a "special function"... I think

Oh, ok. The reason why I stick with 2.5 is because of WConio, and I haven't been able to find out how to get it to work with 2.6 yet. I'd need to modify the .pyd file for it, but I have no idea how to do that (the file looks like gibberish to me when I open it in Windows).
http://newcenturycomputers.net/projects/wconio.html

WConio

Is that kind of like the curses library for C?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.