Level 3 : What will be the value of ‘result’ in following Python program?


list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
result.extend(i for i in list1 if i not in (list2+list3) and i not in result)
result.extend(i for i in list2 if i not in (list1+list3) and i not in result)
result.extend(i for i in list3 if i not in (list1+list2) and i not in result)

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