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