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


x = 10
y = 20

Author: KaivalyaG | Tags: swapping | 1736+ Python FAQs | Share
pickling-&-unpickling | classes | control-flow | type_conversion | while-else-loop | debugging | python-history | generators | precedence-and-associativity | loop | sum-function | built-in-function | python-django | polymorphism | statement | lists | exponentiation | condition | __all__-attribute | list | max-min | conditional-statement | nested-loop | overflow | thread | math-copysign | operator | destructor | threading | binary-operation | filter | update | mathematics | format | counter-function | choice | formal-and-actual-parameter | comparison | regular-expression | pep | join | escape-operator | higher-order-function | operator-or | methods | functions | recursion | expand-tab | string-method | round-function | return-statement | immutability | conversion | for | global-variable | global-keyword | function | numeric | conditional-statement | file_handling | recurssion | complex | __init_subclass__ | keyword | call | type-conversion | matrix | datetime | dictionary | list-join | pseudocode | factorial-function | oop | floating-point-precision | access-modifier | set | heap-memory | error | mapping-function | zip | range | encoding | numpy | postfix | boolean-and-non-boolean | immutable-data-type | generator | datatype | operator-and | integer | stack | function-and-scope | collection | scientific-notation | operand | pandas | feature | method | expression | while-and-for-loop | random | file-handling | iterator | rollback | matplotlib | assignment-operator | list-operation | tuple | type-conversion | docstring | counter | min-max-function | touples | mathematical-function | staticmethod | tuple-unpacking | decimal | assert | data-type | objects | memory-management | string-slicing | module | syntax-error | multiple-inheritance | sorting | file-handling | int | package-management | operators | memory | string-method | match | interpreter | collections | array | slicing | string-concatenation | inheritance | lambda | invalid-list | loops | virtual-environment | loop-control | string-formatting | round | sys | async | string-formatting | print-statement | split | operator-overloading | filter-function | class | operations | default-mutable-argument | while-loop | bitwise-operator | random-function | __future__ | string-manipulation | attribute | multithreading | logical-operator | head-and-tail | matrix-list-comprehension | asyncio-module | command-line-parsing | data-type | list-mutation | import-method | enumerate() | arithmetic-expression | dictionaries | regex | data-structure | binary | basic | exception-handling | implementation | lambdas | virtual-environment | list-slicing | list-method | version | append | list-vs-tuple | functional-programming | mutable | arithmetic-operation | iterable | constructor | list-indexing | input-function | encapsulation | math | init | decorator | class-and-inheritance | identifier | complex-number | data-structure | string | application | indentation | class-and-object | mysql | library | built-in | version-check | list-comprehension | syntax | boolean | goto-function | python-repl | parameter | min-function | logical-operator | string-slicing | exception | string-iteration | design-principle | name-mangling | python | turtle | odd-number | gil | else-statement | context-manager | variable | function-argument | id-function | object-attribute | global-variable | installation | precedence | benefit | namespace | file | deep-copy | fabs-function | print | syntaxerror | comprehension | sum() | input | magic-method | indexing | input-function | list-comprehension | bitwise-operator | syntax-error | python-module | control-flow | zfill-function | swapping | dicts | error-handling | inherit | map-function | exception-handling | descriptors | oops | data_structure | global | static-method | raise | set-operation | sorted | class-and-instance-variable | namedtuple | center | zip-function | slice | lambda-function | typeerror | def | asyncio | software-design | compute | generators-in-python | sys-module | built-in-function | logical-operation | multiprocessing | identity-operator | shallow-copy | control-statement | yield | with-statement | identity-operator | data-structures | python_version | frozenset | bitwise | copy | comment ...