From 43f2e6223f7bba5bc2428c7ea19155285a6e4d9c Mon Sep 17 00:00:00 2001 From: Michael G <44246042+mikejgurch@users.noreply.github.com> Date: Sun, 12 May 2019 16:31:47 -0500 Subject: [PATCH] Added another example to defining-functions article (#28449) Added an example to help show how to define and call functions in a simple and easy to understand manner. --- .../python/defining-functions/index.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/guide/english/python/defining-functions/index.md b/guide/english/python/defining-functions/index.md index 5d3f133eb0..ac1ac5702f 100644 --- a/guide/english/python/defining-functions/index.md +++ b/guide/english/python/defining-functions/index.md @@ -48,3 +48,24 @@ We can define a function inside another function! If a function is defined inside another function, the inner function can only be called inside the function in which it was defined. +### Another Example + +```python +>>> def print_letters_blank(name): # define the function, give a argument if necessary + + # loop to print out each letter in the name + for letter in name: + print(letter) + +>>> print_letters_blank("John") # call the function +>>> print_letters_blank("Sarah") # call the function again, but with a different argument +J +o +h +n +S +a +r +a +h +```