Tuple.

Slides:



Advertisements
Similar presentations
Dictionaries: Keeping track of pairs
Advertisements

String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
DICTIONARIES. The Compound Sequence Data Types All of the compound data types we have studies in detail so far – strings – lists – Tuples They are sequence.
Guide to Programming with Python
COMPUTER SCIENCE FEBRUARY 2011 Lists in Python. Introduction to Lists Lists (aka arrays): an ordered set of elements  A compound data type, like strings.
October 4, 2005ICP: Chapter 4: For Loops, Strings, and Tuples 1 Introduction to Computer Programming Chapter 4: For Loops, Strings, and Tuples Michael.
Data Structures in Python By: Christopher Todd. Lists in Python A list is a group of comma-separated values between square brackets. A list is a group.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 9 More About Strings.
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
Built-in Data Structures in Python An Introduction.
10. Python - Lists The list is a most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 8: Fun with strings.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
Python Mini-Course University of Oklahoma Department of Psychology Day 3 – Lesson 11 Using strings and sequences 5/02/09 Python Mini-Course: Day 3 – Lesson.
14. DICTIONARIES AND SETS Rocky K. C. Chang 17 November 2014 (Based on from Charles Dierbach, Introduction to Computer Science Using Python and Punch and.
Count Controlled Loops (Nested) Ain’t no sunshine when she’s gone …
Guide to Programming with Python Chapter Five Lists and dictionaries (data structure); The Hangman Game.
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Introduction to Computing Using Python Repetition: the for loop  Execution control structures  for loop – iterating over a sequence  range() function.
Python Data Structures By Greg Felber. Lists An ordered group of items Does not need to be the same type – Could put numbers, strings or donkeys in the.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
Dictionaries Alexandra Stefan CSE1310 – University of Texas at Arlington.
Python Fundamentals: Complex Data Structures Eric Shook Department of Geography Kent State University.
Guide to Programming with Python Chapter Four Strings, and Tuples; for Loops: The Word Jumble Game.
String and Lists Dr. José M. Reyes Álamo.
Tuples and Lists.
Python - Lists.
Containers and Lists CIS 40 – Introduction to Programming in Python
Basic operators - strings
Section 6: Sequences Chapter 4 and 5.
Repetition: the for loop
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
COSC 1323 – Computer Science Concepts I
File Handling Programming Guides.
Bryan Burlingame 03 October 2018
Bryan Burlingame Halloween 2018
Creation, Traversal, Insertion and Removal
CHAPTER THREE Sequences.
Guide to Programming with Python
CS190/295 Programming in Python for Life Sciences: Lecture 6
6. Lists Let's Learn Python and Pygame
8 – Lists and tuples John R. Woodward.
Data Structures – 1D Lists
Intro to Computer Science CS1510 Dr. Sarah Diesburg
String and Lists Dr. José M. Reyes Álamo.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Lists in Python Outputting lists.
Topics Sequences Introduction to Lists List Slicing
Dictionaries Dictionary: object that stores a collection of data
6. Dictionaries and sets Rocky K. C. Chang 18 October 2018
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Dictionaries: Keeping track of pairs
JavaScript: Arrays.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
15-110: Principles of Computing
Bryan Burlingame Halloween 2018
Repetition: the for loop
Topics Sequences Introduction to Lists List Slicing
Intro to Computer Science CS1510 Dr. Sarah Diesburg
For Loops Pages
Introduction to Dictionaries
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Dictionary.
Python List.
Introduction to Computer Science
Presentation transcript:

Tuple

A Tuple is a collection of Python objects separated by commas A Tuple is a collection of Python objects separated by commas. In some ways a tuple is similar to a list in terms of indexing, nested objects and repetition but a tuple is immutable unlike lists which are mutable. Tuple

Creating tuple Tuple can be created by using (), Example: Tuple Name=("a", "b") From now we will using t for tuple name Or using tuple constructor,       Example: t=tuple(("a", "b"))       Note the double round brackets First is for tuple function      and second is a iterable having elements to add in the list. Creating tuple

Tuple uses indexing to store elements so we can access items using indexes, Example: t[Index Number] This will return element on that index. We can print this and can also take it into a variable. Can also access all elements using for loop, Example: for i in t: print(i) Accessing tuple

Tuple functions Method Description count() Returns the number of times a specified value occurs in a tuple index() Searches the tuple for a specified value and returns the position of where it was found Tuple functions

Made by Tanmay mudgal