filmov
tv
METR1313 - Week 5 - Segment 2: Python len() Function

Показать описание
The len() function can operate on a list or a string (something we'll cover later on). In the case of a list, len(nameOfList) returns the number of items in nameOfList. For a string, len(nameOfString) returns the number of characters in nameOfString. IMPORTANT NOTE: No matter where the len() function appears in a Python program, the operation is ALWAYS THE SAME (counting how many items/characters are in a list/string).