How to Find & Print the Size of a Tuple in Python | EP-13 Find the Size of a Tuple | What is Tuple?
1. Using getsizeof() function:
"""getsizeof() function belongs to the python’s sys module"""
import sys
tuple1 = (1,2,3,4)
print("size of tuple:"+ str(sys.getsizeof(tuple1))+"bytes")
2. Using inbuilt __sizeof__() method:
"""
__sizeof__() method to determine the space allocation of an object without any
additional garbage value."""
tuple2 =("cybrosys")
print("enter the size of tuple2:"+str(tuple2.__sizeof__())+"bytes")
#pythonprogramming #pythonhelp #pythontips #tuple #findsizeof #pythonbasics #learnpython #Python #Coding #PythonForBeginners #ProgrammingTutorial #TechTonic #Developer #PythonTips
Connect With Us:
—————————————
➡️ Website: https://www.cybrosys.com/
➡️ Email: info@cybrosys.com
➡️ Twitter: / cybrosys
➡️ LinkedIn: / cybrosys
➡️ Facebook: / cybrosystechnologies
➡️ Instagram: / cybrosystech
➡️ Pinterest: / cybrosys