Python #len function for super beginners

environment windows7 (I want a Mac Book Pro 16inch) Visual Studio Code chrome python ver3.8.3

This article is written for beginners in programming and Python.

len function

What is the len function? The characters may be difficult to see on a PC. l L, e E, n N de len. This function tells you the length of the string and the number of elements written in the argument (hikisu).

I'm wondering "what is that?", But it's a function that I sometimes see when writing various code. Maybe programming needs the length of this string and the number of elements. So how do you write it? Python #function 2 for super beginners of Python As mentioned in the len function A built-in function that does not return a return location. The writing method is very simple.

len.py


len('String')

is.

For example

len.py


print(len('Michael Jackson'))
#15

print(len('Good morning World'))
#10

In this way, the length (number) of the character string is output.

Next is the number of elements. Lists and dictionaries output like this.

len.py



print(len(["Billie Eilish", "Beyoncé", "John Legend"]))
#3

print(len({"Ariana Grande": 1993, "LionelRichie": 1949, "CardiB": 1992}))
#3

In this way, the number of elements has been taken.

fin

table of contents

Python #Hello World for super beginners

Python for super beginners and super beginners # Easy to get confused

Python #type (type) and how to check type (type) for super beginners of Python

How to convert Python # type for Python super beginners: str edition

How to convert Python # type for Python super beginners: int, float edition

Read Python # .txt file for super beginners in Python with working .py

Python #Function 1 for Python Super Beginners

Python #Function 2 for super beginners of Python

Recommended Posts

Python #len function for super beginners
Python #function 2 for super beginners
Python for super beginners Python #functions 1
Python #list for super beginners
Python for super beginners Python # dictionary type 1 for super beginners
Python #index for super beginners, slices
Python #Hello World for super beginners
Python for super beginners Python # dictionary type 2 for super beginners
Let's put together Python for super beginners
python textbook for beginners
OpenCV for Python beginners
Python for super beginners Python for super beginners # Easy to get angry
About Python external module import <For super beginners>
Learning flow for Python beginners
About python beginner's memorandum function
Python3 environment construction (for beginners)
Basic Python grammar for beginners
100 Pandas knocks for Python beginners
~ Tips for beginners to Python ③ ~
How to convert Python # type for Python super beginners: str
Python # How to check type and type for super beginners
python function ①
Python Exercise for Beginners # 2 [for Statement / While Statement]
[Python] function
How to convert Python # type for Python super beginners: int, float
Beginners use Python for web scraping (1)
[Python] Reasons for overriding using super ()
Run unittests in Python (for beginners)
Beginners use Python for web scraping (4) ―― 1
python function ②
INSERT into MySQL with Python [For beginners]
[Kaggle for super beginners] Titanic (Logistic regression)
[Python] Minutes of study meeting for beginners (7/15)
[Python] Read images with OpenCV (for beginners)
WebApi creation with Python (CRUD creation) For beginners
Atcoder standard input set for beginners (python)
[For beginners] Try web scraping with Python
A textbook for beginners made by Python beginners
python [for myself]
python enumerate function
Roadmap for beginners
Python> function> Closure
[Python] Generator function
Python> function> Inner function
Beginners practice Python
Python function decorator
Python beginner's note
Notes for Python beginners with experience in other languages 12 (+1) items by function
Memo # 4 for Python beginners to read "Detailed Python Grammar"
The fastest way for beginners to master Python
[Python] I tried substituting the function name for the function name
Memo # 3 for Python beginners to read "Detailed Python Grammar"
Memo # 1 for Python beginners to read "Detailed Python Grammar"
~ Tips for Python beginners from Pythonista with love ① ~
Understand Python for Pepper development. -Python box self-made function-
Note for formatting numbers with python format function
Try to calculate RPN in Python (for beginners)
Memo # 2 for Python beginners to read "Detailed Python Grammar"
Memo # 7 for Python beginners to read "Detailed Python Grammar"
Introduction to Programming (Python) TA Tendency for beginners
Installing TensorFlow on Windows Easy for Python beginners