The given Python code snippet defines an empty tuple and prints its length using the __len__() method.
Code:
data = ()
print(data.__len__())
Explanation:
data = () initializes an empty tuple.
data.__len__() is a method that returns the number of items in the tuple.
Since the tuple is empty, the length is 0.
Expected Output:
0
Please try with two underscores instead of one. .__len__ exist.
upvoted 1 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
hovnival
5 days, 4 hours agoVinzBetel7
1 week, 4 days agoNfyughguygjhg
3 weeks, 1 day agoraYda
3 weeks, 3 days agoAmeer
3 weeks, 4 days agoDont_Stop_Learning
2 months agochristostz03
4 months, 1 week agoVano1
1 month, 3 weeks ago