Ask 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 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)

+3
Answers (1)
  1. 17 May, 06:00
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers