I don't have an Python example of your situation (cause I'm a Python newbie), but consider this:
Notice the lack of Python code to take any number between 0 and 25 (for this example), decide if it's divisable by three, and if divisable by three, give a remainder.
for i in range (0,25) :
if i == 0 :
print i, '(zero) is not a divisable number'
elif i % 3 == 0 :
print i, 'is evenly divided by three'
if i == 1 :
print i, '(One) is not evenly divisable by three'
elif i % 3 == 1 :
print i, 'is divisable by three with a remainder of', i % 3
if i == 2 :
print i, '(Two) is not evenly divisable by three'
elif i % 3 == 2 :
print i, 'is divisable by three with a remainder of', i % 3
Writing this code in any other language would be longer and more complex.
For further help on Python,
**Listed in the order I used them and in a perceived order of difficulty**
1. Python Babysteps Tutorial:
http://coolnamehere.com/geekery/python/pythontut.html
2. Python Tutorial:
http://martin.f2o.org/python/tutorial
Last note: You know that huge popular MMORPG 'EVE"?? A lot of it's code in written in Stackless Python.




Reply With Quote