a +b ?

Xavier Ho contact at xavierho.com
Fri Jun 11 10:41:14 EDT 2010


2010/6/12 yanhua <gasfans at 163.com>

> 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.
> --
>

The reason it looks complicated is because you're using one variable for
everything you do. Look at others' answers - most of them are simply
combining them into one line.

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100612/ac772174/attachment.html>


More information about the Python-list mailing list