Hi all,

I'm writing a calculator for an online game that I used to play but don't seem 
to be able to break out of the while loop, the program will just go over and 
over the loop, crashing the program and I don't know if Python is just really 
slow at this type of thing or i'm doing it completely wrong in Python (the 
equivalent code in JavaScript works fine).

Python code -

def main():
    usedPocketsOne = 192000
    junkiesOne = 500
    labSpaceOne = 0

    resultOne = 0
    while usedPocketsOne > (junkiesOne - labSpaceOne) * 17:
        resultOne = resultOne + 1
        usedPocketsOne = (UsedPocketsOne - junkiesOne + labSpaceOne) * 17
        junkiesOne = junkiesOne + 1

main()

And the JavaScript equivalent (incase there are any stalwarts beside Alan here) 
-
 
function main() {
var usedPocketsOne = 192000
var junkiesOne = 500
var labSpaceOne = 0

var resultOne = 0
while (usedPocketsOne > junkiesOne - labSpaceOne * 17) {
    resultOne = resultOne + 1
    usedPocketsOne = usedPocketsOne - junkiesOne + labSpaceOne * 17
    junkiesOne = junkiesOne + 1
}
}

Thanks in advance for any help :)
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to