Code Learning#PYTHON#9422
Back
Tuple creation variations
Tuple can also be created directly like lists by item values assignment in a parentheses. Other ways are to use constructor based creations using tuple() function. Single value tuple creation needs an extra comma after the item value.
Source Code
Run Output
Notes
- The function tuple() is called the constructor, which can be used to convert one form to another..
- Watch for extra comma ( , ) while created a single item tuple.
- Tuple concatenation always creates a new tuple without affecting values of the tuple being concatenated.
Suggested Filename(s): tuple_creation.py
