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