Question-145: Please map following

 

Parameters: They are part of the function definitions

  1. Get all Questions and Answer from here
  2. You need to have paid subscription to access all questions
  3. Thanks for considering Python Certification Material

 

Answer:

Exp:

def calculate(x):

    print("Your calculated value is ", x*x+10)

Parameters to functions

  • As we have seen in previous calculate(x) function, we are passing one parameter, named as x.
  • There are two things, which you need to remember
    • Parameters: They are part of the function definitions. And remain only in function and not accessible outside function.
    • Arguments: While invoking a function, you must have to pass exact same number of arguments as number of parameters defined on function. In case of calculate(x) has one parameter, so while invoking (calling) this function should have pass one argument.

Defining a function with 2 parameters and invoking with 2 arguments.

  • In function definition, we are having two parameters ( a and b).
  • While invoking this function we are passing two arguments (x,y)
  • Hence, when function is called aà x and bà y
  • It is not necessary that arguments and parameters has to have different name. Means in function definition you are having a,b and while calling you have arguments name as x,y

#Defining a function with two parameters

def multiply(a,b):

    print("Multiplication is ", a*b)

 

i=0

while(i<10):

   

You can access to full explanation to question and answer from this page.

 

Why Dont you prepare for Python Certifications and Interview Questions with 250+ Questions and Answer : Check Here

Real Exam Number of Questions: 70 Questions
Real Exam Pass Score: 70%
Time Allotted: 90 minutes to complete exam