FAQ: Introduction to Functions - Multiple Parameters


#1

This community-built FAQ covers the “Multiple Parameters” exercise from the lesson “Introduction to Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Multiple Parameters

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

What am I doing wrong?


#3

I’m having issues too, only I went with this. Not running though. Could sure use some help.


#4

Defining a function only gives it a name, specifies the parameters that are to be included in the function and structures the blocks of code.

Once the basic structure of a function is finalized, you can execute it by calling the function

you never call the functions, thus the functions never execute

@balint2, you call the functions, but the function calls are nested inside the functions. The function calls should be outside/after the function


#5

Hi, I still don’t understand why “mult_x_add_y(5,2,3)” doesn’t work…

Edit: Never mind, I worked it out. I wasn’t paying attention to indentation…


#6

Hi, after renaming the function to mult_x_add_y And now, add x and y as parameters of the function, after number .

Maybe, it would help to precise that the function has 3 ( THREE ) parameters : 1 - number, 2 - x and 3 - y

this kind of precision would help understand the change in the numbers of the parameters, and ease the execution of the following instructions.
BR
Vince


#7

We cannot evaluate values in the parameter list.

#wrong
def foo(1 - number, 2 - x and 3 - y):
    pass

foo(a, b, c)

#right
def foo(number, x, y):
    pass

foo(1 - a, 2 - b, 3 - c)

The latter example evaluates the arguments and passes the resulting values.


#8

Yes. You are right. And I agree with you.The 3 parameters remark deals with the way the question is worded in the course. I would have spent less time trying to solve this simple question if it was written more clearly : Now add two parameters to the parameter number. Now, the function have 3 parameters. That’s a way to ease the study and is more related to the teachers team. It is a matter of clarity.


#9

The function mult_two_add_three takes a number, multiplies it by two and adds three. We want to make this more flexible. First, change the name of the function to mult_x_add_y .

Sure, I’d love to. But how do I change the name of a function? Kinda confused here.

ETA: I got it now. It wanted me to literally change the name of the function in the code, which had been empty/overwritten with stuff from previous sections. Had to reset the section.


#10

How do I rename a function?


#11

when you define a function:

def example():

you can rename the function at the definition:

def rename():

#12

I don’t get it either. I think my code looks the same as the answer, but it doesn’t work!!