The 365 Data Science team is proud to invite you to our own community forum. A very well build system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Python (multiple arguments

Python (multiple arguments

0
Votes
5
Answer

I have followed the steps for multiple arguments functions but i got an error 
def subtract_bc(a,b,c): 
      result = a-b*c 
      print (‘parameter a eqauls’,a) 
      print(‘parameter b equals’,b) 
      print(‘parameter c equals’,c) 
      return result 
i executed as subtract_bc(10,3,2), i was that the above was not defined

5 Answers

365 Team
0
Votes

Hi Lambert!
Thanks for reaching out.
It seems that you have used other symbols, not single quotes. Remember that we need single quotes (or double quotes) to indicate a string value.
Please retry with the following code.

def subtract_bc(a,b,c): 
    result = a-b*c 
    print ('parameter a eqauls',a) 
    print ('parameter b equals',b) 
    print ('parameter c equals',c) 
    return result

Hope this helps.
Best,
Martin

I have used these quotes (‘ ‘) appropriately but i still get the error , i don,t understand why

3 weeks

Hi Lambert! Can you please retry with double quotes instead: print (“parameter a equals”,a) ? If this doesn’t help, please provide a screenshot containing the entire error message obtained. Thank you.

3 weeks

where can i send the screenshot message? I dont see the option to upload the document

3 weeks

365 Team
0
Votes

Hi Lambert!
Please use the Add Media button to do that.

Hope this helps.
Best,
Martin

how to add this media button?

3 weeks

Hi Lambert, could you please check again? Best, Iliya

3 weeks

365 Team
0
Votes

Hi Lambert!
All you need to do is execute the code cell containing the code we mentioned above, i.e. the one that will define the subtract_bc() function. For the moment, you have only written code. However, without executing it, your computer cannot know what function subtract_bc() is when you are referring to it later.
Hope this helps.
Best,
Martin

0
Votes

 
 
As requested this ,the error code i got 

365 Team
0
Votes

Hi Lambert,
The function in question is not defined, because you haven’t executed the cell where you define it.
This is evident from the input indicator on the left hand side.
In [ ] -> implies that the code hasn’t been executed;
In [*number*] -> implies that the code has been executed and with a consecutive number *some number*
To fix that, simply run the cell with the function and it should work alright!
Kind regards,
Iliya