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