0

Description:

Define a function named map_squared_on_args(*args) which takes flexible integers and returns the a map object which is able to generate squared numbers among *args.

I typed this:

def map_squared_on_args(*args):   
  return list(map(lambda x:x**2, list(filter(lambda x: type(x)==int , args))))

And it shows:

NameError: name 'map_squared_on_args' is not defined

Please tell me how to fix that! Thanks a lot and apologize for the basic question.

2
  • 1
    Your definition of the function works for me. Have you executed the code where you define your function before calling it? Have you checked for typos between the function definition and calling of the function? Commented Apr 15, 2021 at 13:17
  • 1
    Your issue is not reproducible. Please considering adding more detail - including the line of code actually throwing this error. Commented Apr 15, 2021 at 13:24

1 Answer 1

1
#Define the function
def map_squared_on_args(*args):   
  return list(map(lambda x:x**2, list(filter(lambda x: type(x)==int , args))))

#Call the function
map_squared_on_args(args)
Sign up to request clarification or add additional context in comments.

1 Comment

you can improve your answer with some sample args to pass...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.