WeRCopyPasteDeveloper
Pages - Menu
Home
Python
Android
Advance Java
Management
My Playstore Application
Saturday, November 16, 2019
Swap Variable
Swap Variable
In Python swap values in a single line and this applies to all objects in python.
Syntax:
var1,var2=var2,var1
Example:
>>> a=10
>>> b=20
>>> print(a)
10
>>> print(b)
20
>>> a,b=b,a
>>> print(a)
20
>>> print(b)
10
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Mnemonic Variable Names
Mnemonic Variable Names This can confuse beginning students because well-named variables often “sound” so good. Example: x1q3z9oc...
Python Literals
Python Literals - Literals define set of rules to represents value. - A literals is a function for representing a fixed value. -...
No comments:
Post a Comment