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