Python> function> Inner function

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 2677 / 12833)

Inner Functions

An inner function can be useful when performing some complex task more than once within another function,

I've tried.

http://ideone.com/H9k6Dp

import numpy as np


def check_zundoko():
	ints = np.random.randint(2, size=10)

	def zunOrDoko(aval):
		if aval == 0:
			print('zun,'),
		else:
			print('doko,'),

	print(ints)
	for elem in ints:
		zunOrDoko(elem)
	
check_zundoko()

result


Success	time: 0.03 memory: 83072 signal:0
[1 1 1 1 0 0 1 1 0 0]
doko, doko, doko, doko, zun, zun, doko, doko, zun, zun,

Recommended Posts

Python> function> Inner function
python function ①
[Python] function
python function ②
Python> function> Closure
[Python] Generator function
Python function decorator
About function arguments (python)
Function execution time (Python)
Python function argument summary
Python print function (sequel)
Python: About function arguments
Time floor function (Python)
Create a function in Python
Python
Use callback function in Python
[python] Value of function object (?)
ntile (decile) function in python
About python beginner's memorandum function
About the enumerate function (python)
python url setting include function
Python #function 2 for super beginners
Nonlinear function modeling in Python
Draw implicit function in python
Python higher-order function (decorator) sample
Immediate function in python (lie)
Call a Python function from p5.js.
Implement R's power.prop.test function in python
Function argument type definition in python
Included notation in Python function arguments
Write AWS Lambda function in Python
[Python] Make the function a lambda function
Python #len function for super beginners
Function synthesis and application in Python
Basic Python operation 2nd: Function (argument)
How to use python zip function
[Python] Difference between function and method
[Python] Function arguments * (star) and ** (double star)
[OpenCV; Python] Summary of findcontours function
Python3> Functions> Function Renaming Mechanism> f = fib
Python basics ⑤
python + lottery 6
Create a Python function decorator with Class
Python Summary
Built-in python
Python comprehension
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python tips
Python basics
ufo-> python (3)
Python comprehension
Precautions when pickling a function in python
install python
Python Singleton
[Introduction to Udemy Python3 + Application] 48. Function definition
python memo