Python allows for multiple assignments in a single statement

Python allows for multiple assignments in a single statement
Python allows for multiple assignments in a single statement
  • swapping in Python is faster and requires only one line of code:

>>> a,b=7,8

>>> a,b=b,a

>>> print (a,b)

OUTPUT:
4 7

Posted in PYTHON.

Leave a Reply

Your email address will not be published. Required fields are marked *