Level 10 : what is the following output code?


def foo(fname, val):
    print(fname(val))
foo(max, [1, 2, 3])
foo(min, [1, 2, 3])

Author: Devakanth | Tags: higher-order-function | 1859+ Python FAQs | Share
magic-method | interpreter | string-formatting | default-arguments | overriding-methods | membership-operators-(in,-not-in) | operator-overloading | statement | int | sys | string-method | dictionary-comprehensions | datatype | inheritance | identity-operator | indentation | heap-memory | slicing | string-methods | syntax-error | set | context-manager | reading-and-writing-files | library | multiple-inheritance | module | operand | sys-module | syntax-error | join | list-comprehension | range | nested-loop | reading-and-writing-large-files-efficiently | identity-operator | handling-missing-values-(fillna,-dropna) | exception-handling | regex | min-function | built-in | round-function | list-mutation | test-discovery | class | bitwise | python-module | append | dictionary | built-in-function | recurssion | class-and-inheritance | floats | set-operation | odd-number | global-keyword | methods | boolean-and-non-boolean | center | assert | error | aggregating-data-with-functools.reduce() | mysql | sorting | collection | stack | list-operation | else-statement | expand-tab | conditional-statement | sorted | filtering-and-indexing | pass | default-mutable-argument | recursion | sets | string-slicing | installation | dictionaries | comprehension | indexing | rollback | logical-operator | pep | string-iteration | asyncio | access-modifier | list | sum() | staticmethod | string-formatting | operator-and | exception | dicts | keyword | def | boolean-masking | functions | benefit | lists | lambdas | error-handling | design-principle | mathematical-function | escape-operator | raise-statement | complex-number | else | string-manipulation | map-function | assignment-operators | method-overloading | exponentiation | encapsulation | operator-or | numpy | function | classes | conditional-statement | parameter | call | precedence | arbitrary-arguments-(*args,-**kwargs) | split | software-design | function-and-scope | creating-and-starting-threads | debugging | memory | random | return-statement | loop | copy | reading:-read(),-readline(),-readlines() | head-and-tail | collections | string-slicing | string | mathematics | bitwise-operator | arithmetic-operation | string-concatenation | sum-function | import-method | logical-operation | numeric | __init_subclass__ | sorting-and-ranking | python | list-join | class-and-object | attribute | static-method | data-type | input-function | syntax | regular-expressions | python-operators | global | error-handling | creating-custom-modules | package-management | list-methods-and-slicing | parsing-with-strptime | lambda-functions | filter-function | enumerate() | id-function | polymorphism | functional-programming | matrix-list-comprehension | assignment-operator | regular-expression | random-function | print-statement | datetime.date,-datetime.time,-datetime.datetime | operators | scientific-notation | math-copysign | string-method | round | dictionary-methods | generators-in-python | time-series-with-pandas | single-inheritance | matrix | mapping-function | method | shallow-copy | python-django | immutability | loops | control-statement | identity-operators-(is,-is-not) | key-value-pairs | lambda | object-attribute | arithmetic-expression | operator | dataframe-and-series-objects | operations | directory-operations | docstring | using-map()-for-transformations | python-syntax-and-structure | compute | formal-and-actual-parameter | iterator | conversion | strings | math | frozenset | gil | global-variable | integers | syntaxerror | version | print | using-lists-as-stacks | counter | slice | init | destructor | data_structure | pseudocode | condition | iterable | introduction-to-threads | input-function | max-min | tuple-unpacking | why-use-multiprocessing-over-threading?-(gil) | zip-function | variable | file | built-in-modules | expression | oop | threading | class-and-instance-variable | typeerror | file-handling | postfix | factorial-function | introduction-to-python | data-structure | using-yield-in-functions | using-else-and-finally | iterators | data-structure | choice | datetime | opening-files-(open()) | list-slicing | defining-functions | decimal | function-argument | working-with-file-paths | using-os-and-pathlib-modules | goto-function | turtle | matplotlib | advanced-file-operations | while-and-for-loop | implementation | asyncio-module | list-comprehension | yield | multiple-inheritance | complex | type_conversion | generator | global-variable | writing:-write(),-writelines() | bitwise-operator | oops | thread-safe-data-structures-(queue.queue) | invalid-list | using-join()-and-is_alive()-methods | loop-control-statements | tuples | lambda-function | difference-between-threads-and-processes | with-statement | zfill-function | logical-operators | tuple-methods | immutable-data-type | working-with-temporary-files-using-tempfile | format | intering | raise | version-check | walking-through-directories-using-os.walk() | namedtuple | virtual-environment | loop-control | list,-set,-and-dictionary-comprehensions | conditional-statements | namespace | list-indexing | constructor | working-with-binary-files-(rb,-wb) | python-repl | booleans | data-structures | control-flow | encoding | built-in-function | input | class-decorators | inherit | python_version | array | pandas | precedence-and-associativity | overflow | boolean | tuple | command-line-parsing | update | counter-function | descriptors | filter | functional-programming | integer | feature | virtual-environment | __future__ | binary | zip | file_handling | list-comprehensions | data-type | control-flow | pickling--unpickling | type-conversion | memory-management | comment | deep-copy | working-with-dates-and-times | file-handling | thread-synchronization | data-structures-in-python | decorator | formatting-with-strftime | managing-directories-with-os-and-shutil | quantifiers-(*,-+,-?,-{}) | type-conversion | data-type-conversions | while-else-loop | fabs-function | unit-testing | multiple-except-blocks | objects | list-vs-tuple | multithreading | python-history | using-the-threading-module | list-method | joining-and-merging-dataframes | comparison | binary-operation | swapping | thread | data-types | using-assertions-(assertequal,-assertraises) | logical-operator | while-loops | name-mangling | exception-handling | __all__-attribute | touples | floating-point-precision | mutable | match | min-max-function | async | indexing:-loc-vs-iloc | higher-order-function | anchors-(^,-$) | type-conversion-and-casting | generators | basic | while-loop | application | multiprocessing | for | introduction-to-multiprocessing | literal-characters-and-special-characters | identifier ...