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