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