Home / MCQ Bank / Computer
Computer Functions In Python

What will be the output of the following Python code? def foo(i, x=[]): x.append(x.append(i)) return x for i in range(3): y = foo(i) print(y)

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • [0, None, 1, None, 2, None]

Related Computer Questions

In a queue, what operation is used to view the element at the front without removing it? How many member functions are there in this C++ class excluding constructors and destructors? class Box { int capacity; public: void print(); friend void show(); bool compare(); friend bool lost(); }; What is the default value of max_input_time directive? Which of these is the name of a type of interface that allows a user to type in commands on a keyboard which gives the computer instructions? What will be the output of the following C# code? static void Main(string[] args) { int a = 4, b = 5, c = 7, u = 9; int h; h = (Convert.ToInt32(u < b)) + (a + b--) + 2; Console.WriteLine(h); Console.WriteLine(b); Console.WriteLine(u < b); }