# Error message

 Chris Knowles · November 27, 2015 Hi Guys, just very slowly working through the 'Tanks' programming videos and have reached a point where Python keeps throwing up the same error message.  startingShell[1] += int((((startingShell[0]-xy[0])*0.015/(currentPower/50))**2) - (turPos+turPos/(12-turPos)))the above is line 356 in the source code.The error that keeps coming up is this..   startingShell[1] += int((((startingShell[0]-xy[0])*0.015/(currentPower/50))**2) - (turPos+turPos/(12-turPos)))ZeroDivisionError: float division by zero,Now this happens if I manually type in the code myself or copy and paste from the code fro the code 'bucky' has provided on the forum. This line of code appears around video 67 and from then on 'Tanks' just crashes. Being new to programming and pygame/python it's got me kind of frustrated as all was going ok'ish to that point.ThanksChris..

## Replies

 Dan P · November 27, 2015 The error that you are seeing means that something is trying to divide by zero.In this case you have((startingShell[0]-xy[0])*0.015/(currentPower/50))**2)Whatever/currentPower/50.So if currentPower was 0, 0/50 = 0 and therefore you will get a divide by zero error.And(turPos+turPos/(12-turPos)If turPos was equal to 12, then 12 - turPos would also be zero.The reason why you don't want to divide by zero is because it causes a short circuit essentially that will power up the chip.https://www.youtube.com/watch?v=mZ7pUADoo58Here is a youtube video to illustrate. Chris Knowles · November 27, 2015 Hi Dan, thanks for the quick answer, just an update. I'm using 'Python 2.7', which doesn't divide 'Floats' as well as 'Python 3'.In this case in this case adding from __future__ import division sorted the problem out. Thanks again for your answer.Chris..
• 1

## Python

130,882 followers