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.
It ended with. However, if you proceed with the function as it is, there is a risk that the understanding will not be deepened, so I will stop here.
What I've pulled out today is this, a function that even beginners can't avoid.
func.py
print('Hello World')
#Hello World
Yes, this print ()
is also a function. Moreover, even if you don't have the ○○ dish
and the variable name
, it will cook if you add the ingredients.
This print function
is called a built-in function
in Python.
How many are there in Python?
Python official website: Types and usage of built-in functions has the types and usage.
There are many more than I expected, but I think I will remember them as I progress through my studies, so I don't have to force myself to remember them.
It gets a little confusing from here, but please remember it as a trivia. It's a very programming way of thinking and I personally like it.
print function
does not return a return valueA normal function returns a return value and assigns it to a variable.
But the print function
is
func.py
print('Hello World')
#Just print Hello World and there is no return value
It says that there is no return value, but in fact, the print function
also returns the return value
.
What are you returning as a return value
? that is
None
It is non, not read as "none". In other words, no
is returned as a return value
.
Mr. A "Mr. B, please return the loaned money"
Mr. B "Mr. A, I'm sorry. I'll return 0 yen."
In other words, we are having such a barren exchange.
So there is no return value. That's why.
fin
Recommended Posts