Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote:
> No, I think your code is very simple. You can save a few lines by writing
> it like this:
>
> s = input('enter two numbers: ')
> t = s.split()
> print(int(t[0]) + int(t[1]))  # no need for temporary variables a and b

Not that we're playing a round of code golf here, but this is a
slightly nicer take on your version:

one, two = input('enter two numbers: ').split()
print(int(one) + int(two))

I like names over subscripts, but that's just me :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to