a +b ?

Alex Hall mehgcap at gmail.com
Fri Jun 11 10:25:21 EDT 2010


On 6/11/10, yanhua <gasfans at 163.com> wrote:
> hi,all!
> it's a simple question:
> input two integers A and B in a line,output A+B?
>
> this is my program:
> s = input()
> t = s.split()
> a = int(t[0])
> b = int(t[1])
> print(a+b)
>
> but i think it's too complex,can anybody tell to slove it with less code.
Just a thought, but less code is not always better; more code and
comments often help others, and even yourself if you return to a
project after some time, understand what the code does and how it
works. However, you could try this:
t=input().split()
print(str(int(t[0])+int(t[1])))
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap



More information about the Python-list mailing list