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