jice is right. Judging from raw_input() and the print statement you are using a Python2 version. There the '/' will do an integer division if you have integers, so 2/5 would give you zero. This has changed with the advent of Python3 where '/' will give you a floating point result and '//' is now the official integer division symbol.