I have doubt on this code... Can u please help me?

maybe,

def lam(a,b):
  # this returns a function
  c = (lambda e, f: e+f)
  print(f"c: {type(c)}")
  return c 

def main():
  a = int(input('enter a value')) 
  b = int(input('enter b value')) 
  x = lam(a,b) # x would now be a function
  print(x(a, b)) # we need to pass a, b to x for the sum a + b to happen 

main()

c: <class 'function'>
3

maybe the two arguments passed to the function lam are not being used

2 Likes

@Santhosh255 Please always post actual code as text, rather than images. Pictures of code:

  • are not good for accessibility, and
  • make it harder for others to help since they cannot simply copy-paste
3 Likes

Also please write what result you are expecting (or wishing to get) and what you actually get.


You are right.