+ 1

Functions as Objects

What can I put in the space to complete? def square (x): return x*x def test(func, x): print (func(x)) test( ______, 42)

24th Jun 2022, 6:54 PM
Yunuen Sarasuadi Acosta Meza
Yunuen Sarasuadi Acosta Meza - avatar
3 odpowiedzi
+ 2
Yes. That's it. test function calls square function with 42 argument with func as alias name..
24th Jun 2022, 7:26 PM
Jayakrishna 🇮🇳
+ 3
What is the test function expecting as first argument? What is purpose of square function? Think again.
24th Jun 2022, 7:18 PM
Jayakrishna 🇮🇳
+ 1
test(square,42) 😀
24th Jun 2022, 7:24 PM
Yunuen Sarasuadi Acosta Meza
Yunuen Sarasuadi Acosta Meza - avatar