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