B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP Delete Tuple in Python with Example | LiveCodeProgramming

Delete a Tuple in Python

Tuples in Python are immutable, which means you cannot delete individual items inside it. However, you can delete the entire tuple using the del keyword.

Python में tuple immutable होता है, इसलिए इसके किसी एक item को delete नहीं कर सकते। लेकिन आप पूरे tuple को del keyword से delete कर सकते हैं।

Example: Delete Entire Tuple
friends = ("Aryan", "Abhishek", "Jayati")
del friends
print(friends)  # This will cause an error
        
Output:
NameError: name 'friends' is not defined

Note: Once deleted, you can't access the tuple again. It will raise a NameError.

ध्यान दें: जब आप tuple को delete कर देते हैं, तो आप उसे दोबारा access नहीं कर सकते। NameError आएगा।