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