On 9 May 2013 07:32, Noufal Ibrahim wrote:
> Gora Mohanty writes:
>
>> On 8 May 2013 23:00, Jagadeesh N. Malakannavar wrote:
>>> I prefer to do it like this
>>>
>> a = list(str(3245325))
>> sum(map(int, a))
>>> 24
>>
>> What does the map() gain you over basic list comprehension:
>>su
Hi everyone:
A colleague pointed me to this comparison of mocking frameworks:
http://garybernhardt.github.io/python-mock-comparison/
-- Sriram
Belenix: www.belenix.org
Twitter: @sriramnrn
___
BangPypers mailing list
Gora Mohanty writes:
> On 8 May 2013 23:00, Jagadeesh N. Malakannavar wrote:
>> I prefer to do it like this
>>
> a = list(str(3245325))
> sum(map(int, a))
>> 24
>
> What does the map() gain you over basic list comprehension:
>sum( [int(i) for i in '3245325'] )
You could drop the [].
On 8 May 2013 23:00, Jagadeesh N. Malakannavar wrote:
> I prefer to do it like this
>
a = list(str(3245325))
sum(map(int, a))
> 24
What does the map() gain you over basic list comprehension:
sum( [int(i) for i in '3245325'] )
ignoring any try/catch for int conversion errors
IMHO, th
I prefer to do it like this
>>> a = list(str(3245325))
>>> sum(map(int, a))
24
>>>
--
Thanks,
Jagadeesh N.Malakannavar
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
On Wed, May 8, 2013 at 5:25 PM, Anand Chitipothu wrote:
> In my 7+ years of Python programming I've never used the input/raw_input
> functions. People coming from C background look for a scanf replacement in
> Python, but that is now the way things are done in Python.
Yeah. I agree. In fact even
Dear Professionals
Greetings from Newt Global!!!
***We do have an urgent job opening for “Python Development” ***
About Newtglobal: Newt Global is a global IT services and Product
development Company headquartered in Irving, USA. Our offshore delivery
center is based out of Chennai, India from
+1
The method explained by Noufal (using try except while trying to convert
input string to int) should be the preferred way of doing what you intend
to do.
On May 8, 2013 5:18 PM, "Noufal Ibrahim" wrote:
> jitendra gupta writes:
>
> x = input("Enter the nu\t")
> > Enter the nu 3
> ty
In my 7+ years of Python programming I've never used the input/raw_input
functions. People coming from C background look for a scanf replacement in
Python, but that is now the way things are done in Python.
You just write a function and call it at the end of the script and run it.
Asking user for
jitendra gupta writes:
x = input("Enter the nu\t")
> Enter the nu 3
type(x)
>
x = input("Enter the STR\t")
> Enter the STR "3"
type(x)
>
>
> Use input(), this will take care of your data type
input is the equivalent of eval(raw_input()). So you get funny things
like th
>>> x = input("Enter the nu\t")
Enter the nu 3
>>> type(x)
>>> x = input("Enter the STR\t")
Enter the STR "3"
>>> type(x)
>>>
Use input(), this will take care of your data type
On Tue, May 7, 2013 at 11:03 AM, Noufal Ibrahim wrote:
> Umesh Tiptur writes:
>
> > Hi,
> >
> > I am very new to pr
11 matches
Mail list logo