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