Math Project Work Fibbonicci Gulshan
Math Project Work Fibbonicci Gulshan
Math Project Work Fibbonicci Gulshan
Output:
()
('python', 'geeks')
('python', 'geeks')
Concatenation of Tuples
tuple1 = (0, 1, 2, 3)
tuple2 = ('python', 'geek')
Output:
(0, 1, 2, 3, 'python', 'geek')
Slicing of Tuple
Slicing of a Tuple is done to fetch a specific range or slice of
sub-elements from a Tuple. Slicing can also be done to lists
and arrays. Indexing in a list results to fetching a single
element whereas Slicing allows to fetch a set of elements.
Note- Negative Increment values can also be used to reverse
the sequence of Tuples.
Tuple1 = tuple('GEEKSFORGEEKS')
Output:
# Removing First element Removal of First Element:
print("Removal of First Element: ") ('E', 'E', 'K', 'S', 'F', 'O', 'R', 'G', 'E', 'E', 'K', 'S')
print(Tuple1[1:])
Tuple after sequence of Element is reversed:
# Reversing the Tuple ('S', 'K', 'E', 'E', 'G', 'R', 'O', 'F', 'S', 'K', 'E', 'E', 'G')
print("\nTuple after sequence of Element is reversed: ")
DELETING A TUPLE
Tuples are immutable and cannot be deleted, but deleting
tuple entirely is possible by using the keyword "del".
For example,
tl-(4. 6. 3. 7. 6. 5. 0) print("Tuple is :". tl)
del (tl)
print("Tuple after deleting") print (t1)
Output
Tuple is: (4, 6, 3, 7, 6, 5, 0)
Tuple after deleting Trackback (most recent call last):
File "<pyshell#6>", line 1, in <module>
print(t1)
NameError: name 'tl' is not defined
CONCLUSION
So after completion of the project topic
"tuple" i learned many things what's is tuple
and how it's work in python, what kind of
things we can actually do in this,
So i conclude my project here i hope, you will
like it.
THANK YOU