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