SlideShare a Scribd company logo
2
Most read
10
Most read
Acknowledgement
I would like to express my special thanks of gratitude to my computer teacher
Mr. Hrudananda Mohanta as well as our principal Mr. Rajendra Prasad Sah
who
gave me the golden opportunity to do this wonderful project on the topic,
which also helped me in doing a lot of Research and I came to know about so
many new things I am really thankful to them.
Secondly I would also like to thank my parents and friends who helped me a
lot
in finalizing this project within the limited time frame.
What is Tuple
How it's used
Creating a tuple
Concatenation of Tuples
Slicing of Tuple
Deleting a tuple
Contents
What is Tuple
A tuple is a collection of objects which ordered
and immutable. Tuples are sequences, just like
lists. The differences between tuples and lists
are, the tuples cannot be changed unlike lists
and tuples use parentheses, whereas lists use
square brackets.
Creating a tuple is as simple as putting different
comma-separated values. Optionally you can
put these comma-separated values between
parentheses also.
How it's used
Tuples are used to store multiple items in a single
variable. Tuple is one of 4 built-in data types in
Python used to store collections of data, the other
3 are List, Set, and Dictionary, all with different
qualities and usage. A tuple is a collection which is
ordered and unchangeable.
# An empty tuple
empty_tuple = ()
print (empty_tuple)
Output:
()
tup = 'python', 'geeks'
print(tup)
# Another for doing the same
tup = ('python', 'geeks')
print(tup)
('python', 'geeks')
('python', 'geeks')
Output:
Creating a Tuple
Concatenation of Tuples
tuple1 = (0, 1, 2, 3)
tuple2 = ('python', 'geek')
# Concatenating above two
print(tuple1 + tuple2)
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.
Output:
Tuple1 = tuple('GEEKSFORGEEKS')
# Removing First element
print("Removal of First Element: ")
print(Tuple1[1:])
# Reversing the Tuple
print("nTuple after sequence of Element is reversed: ")
print(Tuple1[::-1])
# Printing elements of a Range
print("nPrinting elements between Range 4-9: ")
print(Tuple1[4:9])
Removal of First Element:
('E', 'E', 'K', 'S', 'F', 'O', 'R', 'G', 'E', 'E', 'K', 'S')
Tuple after sequence of Element is reversed:
('S', 'K', 'E', 'E', 'G', 'R', 'O', 'F', 'S', 'K', 'E', 'E', 'G')
Printing elements between Range 4-9:
('S', 'F', 'O', 'R', 'G')
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
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.
CONCLUSION
THANK YOU

More Related Content

PDF
Python program For O level Practical
PPT
Computer Laboratory Rules
PDF
Photoshop Beginners Course
PPT
Introduction to Ubantu
PPTX
Windows 10
PPT
Bullets and Styles
PPTX
G Sheets introduction
DOCX
Basic exercises for photoshop
Python program For O level Practical
Computer Laboratory Rules
Photoshop Beginners Course
Introduction to Ubantu
Windows 10
Bullets and Styles
G Sheets introduction
Basic exercises for photoshop

What's hot (7)

PPTX
Node red with Arduino
PPTX
linux introduction
PDF
Photocopier Routine Maintenance
PPT
History of Linux
PPTX
Python programming: Anonymous functions, String operations
PPT
Server client-presentation.
PPT
How ubuntu works???
Node red with Arduino
linux introduction
Photocopier Routine Maintenance
History of Linux
Python programming: Anonymous functions, String operations
Server client-presentation.
How ubuntu works???
Ad

Similar to computer science tuple in python project.pdf (20)

PPTX
Python Collections
PDF
Tuple in Python class documnet pritened.
PDF
Python Is Very most Important for Your Life Time.
PPTX
1.10 Tuples_sets_usage_applications_advantages.pptx
PPTX
Tuples-and-Dictionaries.pptx
PPTX
Chapter 17 Tuples
PPTX
Tuples in python better understanding with slides
PPTX
Chapter 13 Tuples.pptx
PPTX
Tuplemathspresentationonteupleshhhh.pptx
PDF
Introduction of Python-1.pdf
PPTX
tupple.pptx
PPTX
UNIT-3 python and data structure alo.pptx
PDF
DS Module 03.pdf
PPTX
Chapter 13 Tuples.pptx
PPTX
Chapter 3-Data structure in python programming.pptx
PPTX
Effective tuples in phyton template.pptx
PDF
beginners_python_cheat_sheet -python cheat sheet description
PPTX
Tuples class 11 notes- important notes for tuple lesson
PPTX
Data structures and algorithms
PPTX
day 13.pptx
Python Collections
Tuple in Python class documnet pritened.
Python Is Very most Important for Your Life Time.
1.10 Tuples_sets_usage_applications_advantages.pptx
Tuples-and-Dictionaries.pptx
Chapter 17 Tuples
Tuples in python better understanding with slides
Chapter 13 Tuples.pptx
Tuplemathspresentationonteupleshhhh.pptx
Introduction of Python-1.pdf
tupple.pptx
UNIT-3 python and data structure alo.pptx
DS Module 03.pdf
Chapter 13 Tuples.pptx
Chapter 3-Data structure in python programming.pptx
Effective tuples in phyton template.pptx
beginners_python_cheat_sheet -python cheat sheet description
Tuples class 11 notes- important notes for tuple lesson
Data structures and algorithms
day 13.pptx
Ad

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
01-Introduction-to-Information-Management.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Final Presentation General Medicine 03-08-2024.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
VCE English Exam - Section C Student Revision Booklet
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial diseases, their pathogenesis and prophylaxis
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
TR - Agricultural Crops Production NC III.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
01-Introduction-to-Information-Management.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Types and Its function , kingdom of life
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester

computer science tuple in python project.pdf

  • 1. Acknowledgement I would like to express my special thanks of gratitude to my computer teacher Mr. Hrudananda Mohanta as well as our principal Mr. Rajendra Prasad Sah who gave me the golden opportunity to do this wonderful project on the topic, which also helped me in doing a lot of Research and I came to know about so many new things I am really thankful to them. Secondly I would also like to thank my parents and friends who helped me a lot in finalizing this project within the limited time frame.
  • 2. What is Tuple How it's used Creating a tuple Concatenation of Tuples Slicing of Tuple Deleting a tuple Contents
  • 3. What is Tuple A tuple is a collection of objects which ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. Creating a tuple is as simple as putting different comma-separated values. Optionally you can put these comma-separated values between parentheses also.
  • 4. How it's used Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and unchangeable.
  • 5. # An empty tuple empty_tuple = () print (empty_tuple) Output: () tup = 'python', 'geeks' print(tup) # Another for doing the same tup = ('python', 'geeks') print(tup) ('python', 'geeks') ('python', 'geeks') Output: Creating a Tuple
  • 6. Concatenation of Tuples tuple1 = (0, 1, 2, 3) tuple2 = ('python', 'geek') # Concatenating above two print(tuple1 + tuple2) Output: (0, 1, 2, 3, 'python', 'geek')
  • 7. 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.
  • 8. Output: Tuple1 = tuple('GEEKSFORGEEKS') # Removing First element print("Removal of First Element: ") print(Tuple1[1:]) # Reversing the Tuple print("nTuple after sequence of Element is reversed: ") print(Tuple1[::-1]) # Printing elements of a Range print("nPrinting elements between Range 4-9: ") print(Tuple1[4:9]) Removal of First Element: ('E', 'E', 'K', 'S', 'F', 'O', 'R', 'G', 'E', 'E', 'K', 'S') Tuple after sequence of Element is reversed: ('S', 'K', 'E', 'E', 'G', 'R', 'O', 'F', 'S', 'K', 'E', 'E', 'G') Printing elements between Range 4-9: ('S', 'F', 'O', 'R', 'G')
  • 9. 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
  • 10. 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. CONCLUSION THANK YOU