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


l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

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