Python: Simple Function example

In Python, to define a function is very easy. use the def to define a function, you can then call the function directly by name. For example:   #function example def mod_string(msg): msg += " modified! " return msg   test_str = "this is a test" print(mod_string(test_str)) The example function simply append ” modified” to […]