Detailed Print – CSKC
Sign In

Search

siteicon
Code Learning#PYTHON#9418 Back

Duplicates allowed in list and tuple

Both lists and tuples allow duplicate data items as they are a sort of real world data containers and real world data does contain duplicate entries.

Source Code

		 

Click to open popup

Run Output

[10, 20, 20, 30, 30]
5
('A', 'B', 'C', 'C', 'E')
5

Notes

  • Duplicate allowance is a necessary property when you want to store data from an anonymous real world source.
  • Duplicacy is not permissible in set or dictionary keys as they are for the purpose of making references.