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