Level 9 : How can we swap two numbers in python without using the third variable?


x = 10
y = 20

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