Author name: vasu

Python sets

Just like the lists or tuples, a set in python is also one of the collection types. A set is unordered, unindexed, and unchangeable. It is written using curly braces. Example of a set: cities = {'Delhi', 'Mumbai', 'Hyderabad', 'Bhopal'} print(cities) Output: {‘Delhi’, ‘Mumbai’, ‘Hyderabad’, ‘Bhopal’} Set items are unordered …

Python sets Read More »

Python tuples

Like lists, tuples are also used to store multiple values in a single variable. It is a collection that is ordered and unchangeable. Unlike lists, Tuples are written with round brackets. Example sample_tuple = ("east", "west", "north", "south") print(sample_tuple) Output: (“east”, “west”, “north”, “south”) Tuples are ordered Tuples are ordered, …

Python tuples Read More »