python first project

Chris Angelico rosuav at gmail.com
Fri Jan 10 23:29:39 EST 2014


On Sat, Jan 11, 2014 at 3:18 PM, ngangsia akumbo <ngangsia at gmail.com> wrote:
>     purch_price = input("Please enter the price for purchase made: ")
>     purch_p = raw_input("Please enter the reason of this purchase made: ")

Never use input() in a Python 2 program... always use raw_input()
instead. You're mostly right, but you have a few cases where you're
using input(). Probably what you want is int(input()) or
float(input()).

Incidentally, is there a strong reason for using Python 2 for this? If
not, I'd recommend moving immediately to Python 3, as there are an
increasing number of advantages. Unless something actually binds you
to Py2, save yourself the trouble of shifting in a few years' time and
just use Py3 now.

ChrisA



More information about the Python-list mailing list