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