From the course: Python Functions for Data Science
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Python len() function - Python Tutorial
From the course: Python Functions for Data Science
Python len() function
- [Instructor] The function, len is a fundamental built-in function that is used frequently when working with data in Python. Len takes in either a sequence or a collection as input and returns the length of the given object. In other words, len returns the number of items in the given object. Now, I'll be walking through some examples to demonstrate how len can be used. First, let's say that I have a variable named list F, containing a list of some floating point numbers. To find the length of this list, I can call the function len and pass in list F, it would look like this. I'll go ahead and run this cell, as you can see, I got five as the length. Next, let's say that I have a variable named nums containing a tuple of some integers, to find the length of this tuple I can call the function len and pass in nums. It would look like this, as you can see, I got six as the length, then let's say that I have a variable…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Python print() function2m 30s
-
(Locked)
Python input() function2m 1s
-
(Locked)
Python abs() function1m 57s
-
(Locked)
Python round() function2m 10s
-
(Locked)
Python min() function1m 42s
-
(Locked)
Python max() function1m 41s
-
(Locked)
Python sorted() function3m 39s
-
(Locked)
Python sum() function1m 1s
-
(Locked)
Python len() function2m 28s
-
(Locked)
Python type() function2m 22s
-
-
-
-
-
-
-
-