Join Barron Stone for an in-depth discussion in this video Tuples, part of Programming Foundations: Real-World Examples.
- Lists can easily be changed…by adding, removing, or modifying objects.…There is another data type called the tuple…which is similar to a list except for one key difference.…A tuple is immutable which means it cannot be changed.…Just like a list, a tuple contains…a sequence of objects in order…but once you've created a tuple,…you can't change anything about it.…So why would you want to use this tuple thing…which is basically just a more restrictive version…of a list?…The short answer is simplicity.…If I need to store or pass some nugget of information…that's never going to change,…then a tuple is a handy container to do that.…
For example, when I was driving to the store earlier,…I used the GPS function on my cellphone to help me navigate.…When I use the GPS to find out where I am,…it returns the answer as two values,…a latitude and a longitude.…Those two values always go together in that order…so it makes sense for the GPS function…to return them to me as a tuple.…There's no reason I would need to change…those latitude and longitude values later…
- Reusing functions
- Local vs. global variables
- Creating and naming custom objects
- Class inheritance
- Modules and packages
- Multidimensional lists and tuples
- Queues and stacks
- Creating and combining sets
- Storing data in dictionaries
- If/else and switch statements
- For vs. while loops
- Error handling
- Polling and event-driven programming
Skill Level Beginner
Programming Foundations: Design Patternswith Elisabeth Robson2h 19m Intermediate
3. Class Inheritance
4. Modules and Packages
5. Lists and Tuples
6. Queues and Stacks
9. Conditional Execution
11. Error Handling
12. Polling and Event-Driven Programming
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.