Aggregating values with lists and tuples Python 3


show more Aggregating values with lists and tuples provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training show less
please wait ...

Aggregating values with lists and tuples

Python has several sequential types that look like lists of things, and we're going to look at a few of them right now. Let's make a working copy of variables.py and we'll call this variables-lists.py. And we'll open that working copy. So let's create a variable. And we'll just call it x. And we'll assign it a list of values in parentheses (1, 2, 3). And we'll go ahead and we'll print(x).

What print will do with this is it will try to print it in a way that Python could actually create one if it needed to. And so it has it in the parentheses just like that. So let's print the type of it, also. Save that and run it. So the class is tuple. So this is a tuple. And a tuple is created with parentheses. And a tuple is an immutable object. So I can't insert things. I can't append things. I can't delete things. Once I've created it, I've created it.

And I can't change it. So this is useful for a lot of stuff. Perhaps you just to operate on a fix...

Aggregating values with lists and tuples
Video duration: 4m 55s 6h 36m Beginner

Viewers:

Aggregating values with lists and tuples provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training

Subjects:
Developer Web
Software:
Python
Author:
please wait ...