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


a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = [x for x in a if x not in b]
print(c)

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