Level 1 : What will be the output of the following code?


f =lambda x:bool(x%2)
print(f(20), f(21))

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