Ask Question
27 January, 16:12

Given the definition of the function one_year_older:def one_year_older (name, age) : print ('Name:', name) age = age + 1 print ('Your age next year:', age) print () Which of the following statements will invoke the function one_year_older successfully? A. one_year_older (27, 'John') B. one_year_older () C. one_year_older ('John', 27) D. one_year_older ('John') one_year_older (27)

+4
Answers (1)
  1. 27 January, 19:06
    0
    The answer is "Option C".

    Explanation:

    Method Definition:

    In the given python code, a method "one_year_older" is defined, which accepts two parameters "name and age", in which name accepts string value and age accepts integer value. Inside the method the print method is used, that print name variable value then increments the value of age variable by 1 and print its value, in this question except "Option C" all were wrong, which can be described as follows:

    In option A, In method calling first, it passes integer value, then string value that's why it is wrong. In option B, In this method calling there is no parameter is used. In option D, This type of method calling is illegal.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given the definition of the function one_year_older:def one_year_older (name, age) : print ('Name:', name) age = age + 1 print ('Your age ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers