concept this lesson in category python

appears as: this lesson
Get Programming: Learn to code with Python

This is an excerpt from Manning's book Get Programming: Learn to code with Python.

In this lesson, my objective was to inspire you to learn to program. You don’t have to become a professional programmer. Use basic programming ideas and concepts to improve your personal life, even in simple ways. Programming is a skill, and you’ll get better at it the more you practice. As you read this book, try to think of tedious tasks that you’re doing manually that can be solved more effectively with programming, and try to do it.

In this lesson, my objective was to teach you about tuples and how they behave in a similar way to strings. You learned how to get elements at each position by indexing into a tuple and how to slice a tuple to get at elements inside it; these elements can be primitive objects or might even be tuples themselves. Unlike strings, an object inside a tuple can be another tuple, effectively nesting tuples inside tuples. Lastly, you can use tuples to swap the values of two variables. Here are the major takeaways: