Python Tuples,sets,List
Python
Tuples:-
A tuple is a group of gadgets which ordered and immutable. Tuples are sequences, similar to lists. The variations among tuples and lists are, the tuples can not be modified in contrast to lists and tuples use parentheses, while lists use rectangular brackets.
Creating a tuple is as easy as placing one-of-a-kind comma-separated values. Optionally you could placed those comma-separated values among parentheses also
For example:-
tuple = ("ford", "audi", "benz")
print(tuple)
OUTPUT
ford,audi,benz
SETS:-
In this tutorial, you'll examine the whole thing approximately Python units; how they're created, including or doing away with factors from them, and all operations accomplished on units in Python.
A set is an unordered series of gadgets. Every set detail is unique (no duplicates) and have to be immutable (can not be changed).
However, a hard and fast itself is mutable. We can upload or eliminate gadgets from it.
Sets also can be used to carry out mathematical set operations like union, intersection, symmetric difference, etc.
Creating a python sets:-
A set is created via way of means of putting all of the gadgets (factors) inner curly braces , separated via way of means of comma, or via way of means of the use of the integrated set() function.
It will have any variety of gadgets and they'll be of various types (integer, float, tuple, string etc.). But a fixed can't have mutable factors like lists, units or dictionaries as its factors.
set = {1,2,3}
print(set)
OUTPUT
1 2 3
LIST:-
In this article, we'll examine the whole thing approximately Python lists, how they're created, reducing of a list, including or eliminating factors from them and so on.
Python gives a number of compound information kinds regularly known as sequences. List is one of the maximum regularly used and really flexible information kinds utilized in Python.
List = [1,2,3,4,5,6]
print(list)
Output:-
1,2,3,4,5,6
No comments