Level 1 : What will be the output of the following code?


set1 = {2,3,5}
set2 = {5,1,8}
set3 = {}
set3 = set1&set2
print(set3)

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