N = int(input("enter a positive integer:"))
coun = 1
while (N > 0):
coun = coun * N
N = N - 1
return coun
nice = ntime(N)
print(nice)
error: return outside of the function
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, 7 September 2020 at 13:10:57 UTC+5:30, Shivlal Sharma wrote:
> On Monday, 7 September 2020 at 13:08:04 UTC+5:30, Chris Angelico wrote:
> > On Mon, Sep 7, 2020 at 5:36 PM Shivlal Sharma wrote:
> > >
> > > On Monday, 7 September 2020 at 12:5
On Monday, 7 September 2020 at 13:08:04 UTC+5:30, Chris Angelico wrote:
> On Mon, Sep 7, 2020 at 5:36 PM Shivlal Sharma wrote:
> >
> > On Monday, 7 September 2020 at 12:57:16 UTC+5:30, Python wrote:
> > > Shivlal Sharma wrote:
> > > > N = int(input("e
On Monday, 7 September 2020 at 12:57:16 UTC+5:30, Python wrote:
> Shivlal Sharma wrote:
> > N = int(input("enter a positive integer:"))
> > coun = 1
> > while (N > 0):
> > coun = coun * N
> > N = N - 1
> > return coun
> > nice = ntim
from functools import*
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
add = reduce(lambda a : a + 1, nums)
print(add)
error: -
TypeError Traceback (most recent call last)
in ()
1 from functools import*
2 nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> 3 add = reduce(lambd
On Saturday, 29 August 2020 at 02:47:56 UTC+5:30, Ben Bacarisse wrote:
Thanks you all, I was really confused in this code.
> Shivlal Sharma writes:
>
> > I have seen this code on one of competative programming site but I
> > didn't get it, Why output is 9?
> &g
I have seen this code on one of competative programming site but I didn't get
it, Why output is 9?
from functools import *
def ADDS(a,b):
return a+1
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
add = reduce(ADDS, nums)
print(add)
output: 9
--
https://mail.python.org/mailman/listinfo/python-list