Monty @ The Python Coding Place @thepythoncodingplace.com · Mar 7

Problem: any variables created within a function only exist while the function is running. The function's local scope comes and goes quickly. A basic solution is to create a variable in the global scope and access it from the new function you define:

0 likes 1 replies

?

Replies

Monty @ The Python Coding Place · Mar 7

The list `data` keeps track of all the arguments you use each time you call `print_()`. Note how I use a trailing underscore when defining the function so as not to override the built-in `print()`. But you can replace `print()` if you wish, too!