Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (18.4k points)

Hi, I am a relatively new programmer and my teacher gave us this problem to fix.

Thing is, I have no idea what to do because no matter what I do the code refuses to run.

def multiply(a, b):

  a * b

What is wrong with this problem?

1 Answer

0 votes
by (36.8k points)

You're on the right track. It is important to know that functions should return a value, so your code should look like this:

def multiply(a, b):

  return a * b

For something to happen once you run your code, afterward, you must call the function within a print statement and pass it some parameters. For example,


Should output:


If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch 

Browse Categories