Skip to main content
Ask a Question
Asked a question 9 months ago

python code to demonstrate working of reduce() # importing functools for reduce() import functools # initializing list lis = [ 1 , 3, 5, 6, 2, ] # using reduce to compute sum of list print ("The sum of the list elements is : ",end="") print (functools.reduce(lambda a,b : a+b,lis)) # using reduce to compute maximum element from list print ("The maximum element of the list is : ",end="") print (functools.reduce(lambda a,b : a if a > b Why we use end ....in this program.

Fuel your ambition, discover your passion and achieve your professional goals with LetsUpgrade.
Sign Up Now