Quick Print – CSKC
Sign In

Search

siteicon
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

(10, 20, 30)
(10, 20, 30)
()
()
(10,)
(10,)
('A', 'B', 'C', 'D')
(1, 2, 3, 4, 5)
(10, 20, 30)
(1, 2, 3)