Level 1 : Given the following code, what will be the output?


def process_sets(s, t):
    s |= {7, 8, 9}
    t &= {2, 4, 6, 8, 10}
    return s.intersection(t), s.symmetric_difference(t)

s = {1, 2, 3, 4, 5}
t = {4, 5, 6, 7, 8, 9}
result = process_sets(s, t)

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