Ask Question
25 January, 07:11

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)

+1
Answers (1)
  1. 25 January, 07:53
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers