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