Level 1 : What is the output of the following code?


x ={1,3,8}
y = {8,18,2}
z= x.intersection(y)
print(z)

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